KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I am creating a library project for a number of Android apps. The apps all have some common functionality that I wish to include in the library project but the library project functions require use of application specific constants so I am looking for a way to provide the library functions with the names of the constants and allow each app to define them An example of a specific app constant and how it is used within the library project: public class AppConstants { public static final long APP_ID = 6;//Needs to be set for each app } public static long getCurrentAppId(Context context) { return getLongPreference(context, CURRENT_APP_ID_KEY, AppConstants.APP_ID); } This is just one example of approximately 60 constants that need to be defined for each app for a large number of library functions. I would normally just import/include the project specific app_constants.java file but this is not possible in the library project files as it hasn't got a clue about the specific applications (rightly so). So how do I have each specific app override the constants?
Tags (comma-separated)
Save Edits
Cancel