Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
nour bt
296 PointsAndroid Native App , Download Images Bitmap without Memory Leaks
Hi all,
I am developing an android native app, I developed a Listview that will display images(640x640 each image), I want to download these images as Bitmaps, what is the best way to do so.
I implemented a libarary com.nostra13.universalimageloader
Universal Image loader library, but on some phones I am getting out of Memory error.
Could anyone help, Thank you.
Harry James
14,780 PointsHarry James
14,780 PointsHello,
Are you trying to grab the images from the internet? If so, you may have forgotten to close the inputStream which would explain the out of memory error.
If you are, the inputStream should look like this:
Here, the "break" will break the loop. Otherwise, your loop will just carry on running forever!