2

当我的应用程序首次运行时,我会生成一堆图像文件,然后稍后尝试使用 remoteViews.setImageViewUri() 将这些图像放入我的 ImageViews 中。但是,当我运行我看到的应用程序时

01-03 15:05:11.252:W/ImageView(137):无法打开内容:file:///data/data/com.nickavv.cleanwidgets/files/batt_s_19.png 01-03 15:05:11.252: W/ImageView(137):java.io.FileNotFoundException:/data/data/com.nickavv.cleanwidgets/files/batt_s_19.png(权限被拒绝)

由于文件是由这个应用程序创建的,我应该有权从这个应用程序中访问它,对吧?这是我用来检索它的代码:

   File file = new File(context.getFilesDir().getPath(), idName+".png");
   Uri newUri = Uri.fromFile(file);
   myViews.setImageViewUri(id, newUri);

有什么想法吗?

4

1 回答 1

0

而不是使用Uri.parse,使用Uri.fromfile

Uri newUri = Uri.fromFile(file);
于 2013-01-03T20:57:00.627 回答