I have a bunch of image URLs. I have to download these images and display them in my application one-by-one. I am saving the images in a Collection using
There is an option in
BitmapFactory.Options class (one I overlooked) named
inJustDecodeBounds, javadoc of which reads:
If set to true, the decoder will return null (no bitmap), but the out... fields will still be set, allowing the caller to query the bitmap without having to allocate the memory for its pixels.
I used it to find out the actual size of the Bitmap and then chose to down sample it using
inSampleSize option. This at least avoids any OOM errors while decoding the file.