下載圖片如下。 buf
已加載,已有內容,但setImageBitmap
提出警告。任何想法我的代碼有什麼問題? bitmap
應該不是null
。如何在Android中加載/顯示保存在getFilesDir()文件夾中的圖像?
File file = new File(context.getFilesDir(), body + ".image");
InputStream in = new BufferedInputStream(new FileInputStream(file));
byte[] buf = new byte[(int) file.length()];
int numRead = in.read(buf);
Bitmap bitmap = BitmapFactory.decodeByteArray(buf, 0, numRead);
ImageView icon = (ImageView) view.findViewById(R.id.icon);
icon.setImageBitmap(bitmap);
SkImageDecoder ::廠返回null