Custom location of resources folder
I will start with a quick "Hello" since it's my first post on stackoverflow. :) I'm also new to Java and Android so please, be gentle ;)
And now let's get to the point. I'm writing an application which will be published as two independent apps based on two different remote backends and with different looks. I believe I need three things to achieve that:
- a f开发者_如何转开发ew separated classes responsible for exchanging data and information with backend and serving a common interface for the rest of the app,
- two dedicated manifest files (one for each app),
- dedicated "res/" folders
ad 1.
I just designed interfaces implemented by classes closed in packages - one for each backend. Now all I have to do is changing one package including statement before building the app. Is there a better way to do it? I mean - can I somehow dynamically decide which package to include based on some configuration?
ad 2.
While writing this post I just figured that this is actually not necessary since all data in manifest come from resources. If I switch res/ folder - I'm done.
ad 3.
This is actually the main issue I need help with. All I can figure right now is to have to folders named like "res1/" and "res2/" and "renaming" one of them to "res/" before building each application. Is there any way of customizing the location of resources? Maybe you have some other idea how to do the job? I will be very grateful for any help.
Have a look at library projects. You can have your common resources in a library project, referenced from two or more apps. Each app can have its own resources, and if needed, override the default ones.
精彩评论