ant-depalma
ant-depalma

Reputation: 2066

Android - sharing activities/code between different applications

I have a single android app with a custom logo, some custom json service endpoints, occasional custom text, and possibly a custom color scheme.

For my client this particular app will need to be rebranded and distributed as an entirely different app about 5-10 times over. So I'm looking for way to reuse the most amount of code - the activities and services will be identical except for the custom things I mentioned.

First off, how can I share projects in the sense that one project will hold all code (including activities), and the others just modify a few values. I can't think of a smart way to share both service code and activity code with the occasional value thrown in via properties.

Do android layout/string resource files have the ability to pull from properties? Can activities be bundled inside a jar and shared with other projects?

Upvotes: 7

Views: 2795

Answers (2)

Pihhan
Pihhan

Reputation: 808

You do not have to have different java namespaces, they can be common for all projects. All you need is to replace resources and modify manifest to contain different namespace for each application. There is no problem with several applications having the same name of classes inside. Unless you want to rebrand it all the way user could not find it is actually the same code, of course.

Upvotes: 0

Dimitar Dimitrov
Dimitar Dimitrov

Reputation: 564

You can use Android library project to share the common code. Start by reading this article

Upvotes: 5

Related Questions