0

I have created a custom library that contains a UI that is to display data being read in from an external device. I have successfully created and applied the library to the project I need it in.

My main issue is I cant seem to use it at all. Ive tried to create an instance of the class file and this is failure. I have functions inside that class file I would like to use, but am unable since a simple declaration of a new class throws an exception for me.

Basically I dont want you to fix my problem, I want to see how this is done correctly. Ive searched the Internet for days and can not even find examples on how to do this.

I thought it would work just like creating an instance of any other class, but it does not. Thank you.

Greg
  • 1
  • 1
    What do you mean exactly "I cant seem to use it at all"? What IDE are you using? Does it work okay in the IDE just not at runtime? – EpicOfChaos Aug 30 '11 at 20:33
  • Okay. Im using eclipse, and I have my library imported to my project. When I try to create a new instance of the class IE: Display d = new Display(); <-- Throws an exception. So I cant use the functions within my display.. Ive tried creating a new class to contain the functions I need to use and I am able to use them. But the problem here is when I try to update the textviews in the UI I get a null pointer exception. Anyone have any clue where I can find information on how to fix this? Or set it up correctly? The only things I find are what has been currently posted. – Greg Aug 31 '11 at 13:44
  • Can you post your LogCat output? – EpicOfChaos Aug 31 '11 at 14:54
  • I guess the question is if YOU created a library and added it to your project, how would YOU use the UI, functions, and resources in the library? Any time I try I get either "Null pointer" or "Activity not found" – Greg Aug 31 '11 at 18:53

1 Answers1

0

It sounds like you need to do some Eclipse project management.

The custom library including the UI and code that accesses the data source should be in an Android library project (see: "setting up a library project"). The Application which will use this functionality needs to include this library project (see: "referencing a library project").

See the Android docs about Managing Projects from Eclipse.

Daddyboy
  • 1,412
  • 13
  • 19
  • Not even close to what I need. I need to know how to use these functions programmaticly the android docs do not show how to accomplish this. Thanks tho. – Greg Aug 31 '11 at 15:24