What I would like to do is create a configuration/properties/xml file in an Eclipse project that can specify project settings.
The context is that I have one application meant for 2 users. But they need to have different version and build numbers and some other parameters specific for that user. What I would like is to have two configuration files, and then be able to specify Configuration file 1 or 2. The tricky part is that Version Code/name are specified in the android Manifest.
How is the best way to go about doing this?
Requirements:
- Specify in one part of code which configuration/properties file to use. (ie: Config 1 or 2)
- Android Manifest is able to reference this file for Version Code and Version Name.
- I can dynamically reference elements of this file in my code.
So I found a good way to do this. I simply made a “configuration” xml file that has a bunch of resources in it.
ie:
then in my manifest I have
and then I made a configuration class.
Where I just call the Configuration class with the context of my activity passed into the constructor inside of my activities onCreate Method. Works like a charm.
Hopefully this helps someone
Cheers.