简体   繁体   中英

BitmapFactory.decodeByteArray runtime exception

This code gives runtime exception and I can't catch it. BitmapFactory.decodeByteArray doesn't return null or something like this.

Bitmap bitmap = BitmapFactory.decodeByteArray(imbBytes, 0, imbBytes.length);

Note: when imbBytes is byte[] of .png gives error, when .JPG no. I tried save png image in directory to check if byte[] was correct and everything worked fine.

Please help!!!

From the documentation :

Returns The decoded bitmap, or null if the image could not be decode.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM