读取另一个软件包的资产文件夹文件 [英] read asset folder files of another package

查看:53
本文介绍了读取另一个软件包的资产文件夹文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个使用相同android:sharedUserId的android应用程序 说出应用程式A和应用程序B.

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

是否可以从A读取B的资产文件夹的内容?

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

推荐答案

您不需要android:sharedUserId(除非您真的知道自己在做什么,否则使用android:sharedUserId是有风险的) .最后我检查了一下,资产是世界可读的;任何应用程序都可以读取其他应用程序的资产.

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.

这篇关于读取另一个软件包的资产文件夹文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆