Michael Dorin wrote: > Hello, > I am making libraries that I would like to use on different projects. > So far I am just copying the code in... > > Is there an easy way to make a 'library' project...and I import?
That depends on what you want in the library. If the library is just Java code (perhaps using Android SDK APIs), then you can just package up the compiled class files into a JAR. Then, drop that JAR in the libs/ directory of projects wishing to reuse the code (and, if you are using Eclipse, add that JAR to the build path). You can see samples of this technique in some of my CommonsWare Android Components: http://github.com/commonsguy/cwac-adapter http://github.com/commonsguy/cwac-sacklist http://github.com/commonsguy/cwac-endless Look at the "jar" target I added to the build.xml files in each of those projects. This approach has limitations: -- You cannot package resources, so your classes must accept resource IDs as parameters, or you can use Resources#getIdentifier() to try looking up the resource ID by name (though this may be slow). -- While you can put activities and other components in the JAR, the application wishing to use those components still needs to declare those components in its manifest. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy _Beginning Android_ from Apress Now Available! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---

