问题
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