【发布时间】:2013-10-18 04:56:12
【问题描述】:
我正在尝试将字节数组转换为位图以在 android 应用程序中显示图像。但是在转换它时返回空值。我使用了以下代码:
operations = new DataBaseOperations();
byte image[] = operations.fetchimage(); // gets byte array from the database
BitmapFactory.Options options = new BitmapFactory.Options();
Bitmap bitmap = BitmapFactory.decodeByteArray(image, 0, image.length, options);
这里bitmap 为空,为什么?
【问题讨论】:
-
你有正确的image.length吗??
-
检查image[]是否为null..
-
我遇到了同样的问题。这对我有用:stackoverflow.com/a/40882445/4539359