k-thorat
k-thorat

Reputation: 5123

Android Library using Main Project Resources

I am creating a library for Android projects.

The activity is declared in the library project, as it will be reusable in different projects. This activity is using images which are project specific. I have added those images in the main project.

How can I access resources from the main project in the library?

Upvotes: 3

Views: 1887

Answers (1)

Seva Alekseyev
Seva Alekseyev

Reputation: 61341

Put a copy of all relevant resources in the library. It's perfectly legal. If you want to override them in the actual app, you can. If the IDs clash, the end product will use the resources from the app.

EDIT: the alternative is filesystem-level links. On Windows, use mklink to create hardlinks to your resource folders in the project; on *nix, use ln. This may mess up your source control, if any, so proceed with caution.

Upvotes: 11

Related Questions