I know this question has been asked so many times here. I have gone through all that I came across, and unfortunately all of them said the same answer.
My requirement: I need to convert huge byte array to bitmap. By huge I meant, I am sending an http request to fetch an image, the image is fetched as byte array, I need to display this image in my application in an image view. The problem is, the image I need to fetch can be of any size, ranging from 100kb to 10+mb. The following is the solution I found all over the internet for converting byte array to bitmap in android.
Bitmap bitmap = BitmapFactory.decodeByteArray(bitmapdata , 0, bitmapdata.length); //bitmapdata is the byte array
This works perfectly for small images, but as the image size increases to say from 2-3mb onwards, this will crash with an out of memory error. Is there a better way for the bitmap conversion which won't crash my app?