是否有可能访问另一个APK资源,而无需使用内容提供商?有可能、提供商、内容、资源

2023-09-03 20:31:56 作者:離人何必挽

我认为,这是不可能,包含在其他APK接入资源,除非内容提供商的使用。不过,我偶然发现所谓的更好的键盘的应用程序。它采用的外观,所以我决定要下载外观的例子。

I thought that it is impossible to access resources contained in other APK unless content providers are used. However, I stumbled upon an app called Better Keyboard. It uses skins, so I decided to download an example of a skin.

一个例子皮肤真是出乎我的意料。它几乎不含有code,只声明了一个活动,没有内容提供商。 Nontheless它包含了资源,他们显然从某种程度上更好的键盘应用程序访问,如果被安装APK皮肤。那么它是如何做的?

An example skin really surprised me. It contains almost no code, declares only an activity and no content providers. Nontheless it contains resources and they are apparently somehow accessed from Better Keyboard app if the APK with the skin gets installed. So how is it done?

推荐答案

我相信你正在寻找

资源资源= mPackageManager.getResourcesForApplication(org.example.foo);

http://developer.android.com/reference/android/content/pm/PackageManager.html#getResourcesForApplication%28java.lang.String%29

 
精彩推荐
图片推荐