Extending the functionality of an Activity from a referenced library project
I'm developing tab base android application using maven-android-plugin, i need to share the same code base and resources to several applications, so what i did was make the project as library project and reference it to other projects.
Ref:http://co开发者_JS百科de.google.com/p/maven-android-plugin/wiki/ApkLib
Now i need to add more functionality to the activities.so what i did copy the activity from library project and put into the reference project with the same package name,When i run the build i'm getting "duplicate class error",for resources this work fine.
how can i add more functionality to activity (coming from library project)
sam
I could think of the following:
- Subclass the Activity that you want to extend the functionality of.
- Extract the functionality from the original Activity into classes (probably in the form of utility class) and use that in your new Activity
- If this extra functionality is reacting to a particular event that you need to handle, consider extracting the listener in your activity so that you could extend the functionality by setting the listener that conform to a specific Interface from outside your activity
精彩评论