Reputation: 3578
I have an Android app that I'm distributing as a bunch of individual apps, each with their own package name, so they are their own projects in Eclipse. The code for each app is pretty much the same, it just pulls in different data for a remote source and has some different text, which I just change string values for, in the res/values/strings.xml file.
I'm new to Eclipse, so is there a good strategy to setup the projects, so I can share the code between each project? Right now, if I make a code change, I have to manually copy the code to each project.
Upvotes: 0
Views: 139
Reputation: 9189
Yes, there is a great way to reduce duplicate effort with Eclipse and Android projects. First setup a library project where all the common code goes. Second setup an Application project for each application you have. Finally, override resources that are specific to that application. For example if you have a R.string.greeting and one app is for the West Coast US and one is for the Southern US in the library project you'll have "Hello", in the West Coast project you'll have greeting defined as "What's up" and in the South project greeting will be "Howdy".
Upvotes: 1
Reputation: 573
Right click on the package on the left and then hit export. This will turn your project in a .jar which can be referenced by other projects. All you have to do after that add the resource to your project and import it into future classes.
Upvotes: 0