tags:

views:

98

answers:

3

I have a particular collection of code along with some XML files that I need to share with every application I will make.

At the moment I can't because as far as I am aware there is no way to do this. This seems like a massive oversight by the development team.

If the code needs changing, I have to change it in every app that I create - and will create in the future.

Are there any ways to share code in android yet?

I am using Eclipse for development.

+1  A: 

You can reference a third party JAR like you would any Java project. Or are you talking about something else?

As for sharing XML files, I think you may have to just copy them to each project, but I'm not certain about that.

Brandon
Sure, I know you can distribute jars. I am more concerned about the rest - drawables, strings, ids, layouts etc. If I change a simple xml id I then have to go through all my apps and change them one by one.
jax
+5  A: 

You can create an Android library project. The TicTacToeMain sample project in the SDK shows how to reference your created library project.

JRL
Your answer is much better. +1
Brandon
This looks interesting, I will check it out
jax
yep, this is perfect thank @JRL
jax
very good spot!
Jorgesys
A: 

You can reuse particular Activity classes in applications other than the one they were installed with. Is that sufficient?

To do that, you need to set android:exported="true" in the Activity's declaration in AndroidManifest.xml. http://developer.android.com/guide/topics/manifest/activity-element.html has more details.

Jim Kiley