遇到的情况,该httpentity在InputStream的一个图像的二进制数据,处理还其一个库文件[String str = EntityUtils.toString(httpResponse.getEntity())
]被转换为字符串,现在我试图让输入流从那个String返回。如何回到从字符串取得InputStream的
采取以下场景了解这一问题:
工作 - 的ImageView与内容显示
InputStream inStream = getContentResolver().openInputStream(thisPhotoUri);
Bitmap bm = BitmapFactory.decodeStream(inStream);
ImageView view = (ImageView)findViewById(R.id.picture_frame);
view.setImageBitmap(bm);
问题 - ImageView的不与图像显示
InputStream inStream = getContentResolver().openInputStream(thisPhotoUri);
String str = inStream.toString();
InputStream is = new ByteArrayInputStream(str.getBytes());
Bitmap bm = BitmapFactory.decodeStream(is);
ImageView view = (ImageView)findViewById(R.id.picture_frame);
view.setImageBitmap(bm);
试过这个,它没有帮助。由于Bitmapfactory在传递流时返回null。 – Dinesh