Reducing Memory leaks Android

114 views Asked by At

When dealing with images in android for bitmap objects I used to recycle them in order to save when moves to the next screen. But there are times I had to use drawable s instead of bitmaps any way of dealing with these.

Recycle drawable objects just like bitmaps bitmap.recycle() method.

Thanks

2

There are 2 answers

1
himanshu munjal On

You can use third party image libraries. Some good libraries are:

  1. Nostra’s Universal Image loader

  2. Picasso

  3. UrlImageViewHelper by Koush

  4. Volley – by Android team @ Google (mainly network library)

  5. Novoda’s Image loader (depraceted)

    Additionally you can check technotalkative blog for more details:

6
Ewoks On

Here you go with libraries for better image management:

I gave you links to description of libraries on purpose, so you get to know them at least a bit before you just drop them in project. Understanding what they are for and basic concepts about them it will will save you a lot of time later.

Here is how to apply HolderPattern to your list to avoid creating of new object over and over.. Again I would advice to read carefully not just to copy-paste.

One more useful tip and more material to learn - Managing Bitmap Memory ;)

Welcome to Android development ;)