0

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!!!

Big.Child
  • 2,948
  • 4
  • 19
  • 26

1 Answers1

1

From the documentation:

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

user000001
  • 32,226
  • 12
  • 81
  • 108
  • Ys I know but it doesn't return null! I'm using google api 15 – Big.Child Feb 10 '13 at 21:13
  • 1
    Sorry misread. Could you post the exact error and the line that produces it? – user000001 Feb 10 '13 at 21:14
  • Nothing is printed on LogCat I only see error in Expressions windows during breakpoint: An exception occurred: java.lang.OutOfMemoryError and then goes "Source not Found" on whie screen in eclipse – Big.Child Feb 10 '13 at 21:21
  • 1
    Well `java.lang.OutOfMemoryError`... You probably don't have enough memory to decode. Maybe **[this](http://stackoverflow.com/questions/7291029/android-bitmapfactory-decodebytearray-outofmemoryerror-oom)** helps? – user000001 Feb 10 '13 at 21:28