-3

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

Thilina Anuradh
  • 211
  • 2
  • 11

2 Answers2

3

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:

Community
  • 1
  • 1
himanshu munjal
  • 321
  • 1
  • 7
  • #JustForRecords Novoda is deprecated and not maintained any more (abandoned let's say) and that Volley is mainly made for network transfers of, among other things images, so it is a bit of overhead when you want to do just loading resource bitmaps – Ewoks Jun 19 '15 at 07:49
1

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 ;)

Ewoks
  • 12,285
  • 8
  • 58
  • 67
  • Thanks for your feed back I have used Picasso,Fresco and even Glide for image caching but they doesn't suit best at my case and for recycle view and list it works fine agree. – Thilina Anuradh Jun 19 '15 at 07:26
  • In that case you need to elaborate better your use case, otherwise nobody can help you here.. :S – Ewoks Jun 19 '15 at 07:28
  • Any way of clearing Drawable from memory like bitmaps bitmap.recycle() that would be great – Thilina Anuradh Jun 19 '15 at 07:32
  • 1
    that is not the way it should work on newer Androids. Probably you read some tutorial from gingerbread era.. As i suggested learn about holder pattern and additionally how to reduce memory usage by not creating and destroying new objects (especially when they are huge bitmaps). Maybe somebody else offer more satisfying answer that you would accept.. ;) Good luck with the project ;) – Ewoks Jun 19 '15 at 07:35
  • Yes you may be right my game like project uses lots of bitmaps and my way of dealing with images worked pretty well for bitmap objects all I needed was a way to recycle drawable objects(not inside listview) and thanks for the Holder pattern I'll dig in to that Thanks – Thilina Anuradh Jun 19 '15 at 07:42
  • regarding drawable vs bitmap you might want to check this http://stackoverflow.com/a/8937083/304270 – Ewoks Jun 19 '15 at 07:55