【发布时间】:2013-09-14 07:24:03
【问题描述】:
我在将字节数组转换为位图时遇到问题。现在我想要实现的是我将图像作为字节数组获取并尝试转换为位图以便我可以显示图像。但是在我的 位图输出 中运行下面的代码后,我得到 Null 值。
String t= "byte array of the image";
byte[] temp = t.getBytes() ;
Bitmap bmp = BitmapFactory.decodeByteArray(temp, 0, temp.length);
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
System.out.println("bitmap output"+bmp);
我用谷歌搜索了很多,发现这段代码适用于every1。可以请有人告诉我我在哪里做错了。
提前致谢
【问题讨论】:
标签: java android bitmap bytearray