我有一个具有九个补丁图像背景的小部件.
图像保存在/ sdcard / mydir / bgs中.
当我尝试使用setImageViewUri方法加载图像时,我有这个错误:
Unable to open content: file:///storage/emulated/0/sdcard/mydir/bgs
..
然后
…
open failed: EACCES (Permission denied)
这只会出现在主屏幕上,只有Nexus 10和Nexus 7(最新的启动器4.4此错误不存在).我的应用程序中还有一些RemoteView,并且都可以正常工作.
我也添加到清单READ_EXTERNAL_STORAGE,WRITE_EXTERNAL_STORAGE.
我该怎么解决?
更新:我检查了setImageViewUri的方法,我发现它改变了我的文件的路径.
if (value != null) {
// Resolve any filesystem path before sending remotely
value = value.getCanonicalUri();
if (StrictMode.vmFileUriExposureEnabled()) {
value.checkFileUriExposed("RemoteViews.setUri()");
}
}
此方法接收我的值(/ sdcard / mydir / bgs)并将其更改为(storage / emulated / 0 / sdcard / mydir / bgs).但是这个文件不通过adb存在于系统中.