0
我想將字節數組轉換爲位圖,以在Android應用程序中顯示圖像。但在轉換它時返回空值。我用下面的代碼:ByteArray to Bitmap null null
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。 – Riser
檢查圖像[]是否爲空。 –
我有同樣的問題。這對我工作:https://stackoverflow.com/a/40882445/4539359 – Julian