【发布时间】:2011-08-26 03:54:16
【问题描述】:
我有一个文件本地保存到应用程序的私有存储中。我已经验证它存在,但是每当我调用BitmapFactory.decodeFile 它总是返回null。
如果我将文件保存为资源并使用ImageView.setImageResource,它总是显示得很好。
有什么问题?
这里是sn-p:
filename = "test.png";
if (doesFileExist(filename))
Bitmap bMap = BitmapFactory.decodeFile(filename);
我也试过了:
Bitmap bMap = BitmapFactory.decodeFile(getFilesDir().getPath()
+ filename);
【问题讨论】:
-
在 decodeFile() 中,您必须传递文件的完整 pah,而不仅仅是名称或您尝试的方式
标签: android bitmapfactory