read asset folder files of another package

非 Y 不嫁゛ 提交于 2019-12-30 15:42:28

问题


I have two android applications using the same android:sharedUserId Say Application A & Application B.

Is there a way to read the contents of asset folder of B from A?


回答1:


You should not need android:sharedUserId (and unless you really know what you're doing, using android:sharedUserId is risky). Last I checked, assets are world-readable; any app can read another app's assets.

You should be able to call createPackageContext() to get a Context associated with the other app, then use getAssets() as normal to get an AssetManager from that Context.



来源:https://stackoverflow.com/questions/49373591/read-asset-folder-files-of-another-package

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!