Mysterious stacktrace in Android developer console (bitmap size exceeds 32bits)

if it ‘s a matter of quantity, you have to recycle your bitmaps.
if it’s a matter of size (you can’t load too big images), you have to load a lighter copy of your bitmap.

Here is the code to create a smaller image

Options thumbOpts = new Options();
thumbOpts.inSampleSize = 4;
Bitmap bmp = BitmapFactory.decodeFile(imagePath, mThumbOpts);

inSampleSize set to a value > 1, requests the decoder to subsample the original image, returning a smaller image to save memory.
Use a power of 2 for it to be more efficient.

This post may be useful

Leave a Comment