Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 510
k-thorat Avatar asked Aug 11 '26 05:08

k-thorat


1 Answers

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.

like image 112
Seva Alekseyev Avatar answered Aug 14 '26 08:08

Seva Alekseyev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!