jsmith
jsmith

Reputation: 4897

Can you share resources across APK's?

Is it possible to share resources across APK's? For example, can application A (in APK A) load an icon or layout view from application B (in APK B)?

Upvotes: 11

Views: 6237

Answers (4)

Andy1625
Andy1625

Reputation: 41

Two different apps can share resources - images/ files,etc. if they are signed with same certificate. Please check android doc here

Upvotes: 1

Ander Webbs
Ander Webbs

Reputation: 1158

You can make use of getResourcesForApplication

That way you can load whatever you want from other app package as long as you know at least the package name and the id or name of the resource to load.

As a side note, layouts cannot be loaded without further processing them with an XMLResourceParser because of possible id mismatches between your app package and the "guest" package.

Upvotes: 24

Bryan Denny
Bryan Denny

Reputation: 27596

You can have two applications use the same Android library, which lets you share resources like activities, etc.

An Android library project is a development project that holds shared Android source code and resources. Other Android application projects can reference the library project and, at build time, include its compiled sources in their .apk files. Multiple application projects can reference the same library project and any single application project can reference multiple library projects.

Upvotes: 0

Pentium10
Pentium10

Reputation: 208042

Only if it is delivered by content provider and the content serialized.

Upvotes: 0

Related Questions