OutOfMemoryError: bitmap size exceeds VM budget :- Android [duplicate]

Use decodeStream(is, outPadding, opts) with

BitmapFactory.Options opts=new BitmapFactory.Options();
opts.inDither=false;                     //Disable Dithering mode
opts.inPurgeable=true;                   //Tell to gc that whether it needs free memory, the Bitmap can be cleared
opts.inInputShareable=true;              //Which kind of reference will be used to recover the Bitmap data after being clear, when it will be used in the future
opts.inTempStorage=new byte[32 * 1024]; 

Leave a Comment