Strange OutOfMemory issue while loading an image to a Bitmap object

To fix the OutOfMemory error, you should do something like this: BitmapFactory.Options options = new BitmapFactory.Options(); options.inSampleSize = 8; Bitmap preview_bitmap = BitmapFactory.decodeStream(is, null, options); This inSampleSize option reduces memory consumption. Here’s a complete method. First it reads image size without decoding the content itself. Then it finds the best inSampleSize value, it should be … Read more