Reputation: 19848
I have a slight problem. I'm trying to dynamically load images (Jpeg, PNG, etc) from the web and display them in my Android App. This works 99% of the time. However, sometimes the images tend to be so large, that the bitmap blows through the available memory and causes OutOfMemoryExceptions
.
I find that, even though a 3000px by 3000px Jpeg might be only 200 kilobytes, the resulting bitmap can be hundreds of megabytes. Is there a way to load Jpeg/PNG files from the web, into a drawable without converting to a bitmap first?
Upvotes: 0
Views: 581
Reputation: 2669
Playing with bitmap in android is a little tricky, I highly recommend you to read THIS and THIS link from android developer site to get better idea how to load bitmap into memory efficiently. You can also use Universal Image Loader library which is very powerful and plugable library. It takes care of loading bitmap efficiently into memory and there are lots of configuration for you. It also download the image for you from the web.
and lost of other options
Upvotes: 1