2

所以我试图从我的应用程序私有文件目录中的文件中恢复图像。

InputStream inputStream;
BitMapDrawable result;
    try {
        inputStream = new FileInputStream(file.getAbsolutePath());
        result = BitmapDrawable.createFromStream(inputStream, null);
        inputStream.close();
        } catch (IOException e) {
            e.printStackTrace();
        } 
return result;

但显然我做错了什么,因为结果总是空的。

4

2 回答 2

3
new BitmapDrawable( BitmapFactory.decodeFile(file.getAbsolutePath()) );
于 2014-02-04T21:05:37.387 回答
-1

这不是你想要的吗?

Bitmap bitmap = BitmapFactory.decodeFile(file.getAbsolutePath());
Drawable d = new BitmapDrawable(getResources(),bitmap);
imageview.setImageDrawable(d);
于 2014-02-04T21:13:58.957 回答