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)?
4 Answers
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.

- 1,158
- 1
- 8
- 11
-
Hi,can we call java classes from other application? – Rajan1404930 Apr 25 '16 at 07:20
Only if it is delivered by content provider and the content serialized.

- 204,586
- 122
- 423
- 502
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.

- 27,363
- 32
- 109
- 125
-
2Note, however, that library projects are build-time only. Once deployed on the device, the resources are duplicated across applications. – Pontus Gagge Nov 22 '10 at 14:04
-
You can avoid the duplication if the lib is installed on the system. Crosswalk offers this option for example, so the lib of 20MB can be installed once and re-used by any other apps on the system. – Kikiwa Dec 09 '16 at 10:28