javaandroidandroid-support-libraryreusabilitylibrary-project

Android: Reusability of code by creating a library project


I am trying to create a library project to reuse certain things which are common in many applications like splash screen, login screen, asynchronous thread calls for getting data from a URL, custom listView, DAO files, etc.

I want to import this library and then just call the method from this library. Is it possible? If yes, then how to approach for it?

Thanks in advance!


Solution

  • Yes, you can create your own library if you are using Eclipse IDE.

    Create new project and mark that project as library.As shown in the image 
    

    enter image description here

      Create your classes and method in this project.
    

    Now, How to use or include this library in your other projects. See this snapshot

    enter image description here

    Note: Make sure your both projects are present in same workspace.

    After adding your library project you can use methods defined in the classes of your Library.