【发布时间】:2014-09-17 06:41:30
【问题描述】:
当我尝试在位图中转换时,我有 inputStream 对象,但对于某些图像,它仍会返回 null,图像存在。
InputStream responseInputStream = apiResponseModel
.getResponseInputStream();
if (responseInputStream != null) {
Bitmap bmp = BitmapFactory.decodeStream(responseInputStream);
imgProductProfile.setImageBitmap(bmp);
}
【问题讨论】:
-
尝试使用
Options options = new BitmapFactory.Options();options.inJustDecodeBounds = true;BitmapFactory.decodeStream(responseInputStream, null, options); -
别忘了
close()你的responseInputStream