【发布时间】:2014-03-21 05:03:04
【问题描述】:
有一个场景,httpentity 在 InputStream 中有图像的二进制数据,为了进一步处理,它被转换为库文件中的字符串[String str = EntityUtils.toString(httpResponse.getEntity())],现在我试图从该字符串中取回输入流。
请看下面的场景来理解问题:
Working - 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);
【问题讨论】:
标签: java android inputstream raw-data httpentity