2

I am developing an application which has a list view with image. I planned to use lrucache to cache the image.Before implementing i just want to know is there any efficient way to do this(The list view is more or less like a Facebook new feed screen which shows images, comments, title etc)

enter image description here Need some suggestion on implementing this efficiently.

andinrajesh
  • 575
  • 2
  • 9
  • 24
  • did you tried Universal image loader https://github.com/nostra13/Android-Universal-Image-Loader a good project – Iftikar Urrhman Khan May 20 '13 at 06:57
  • i dont want to use third party library in my application. Suggest some ideas for implementing on my own. – andinrajesh May 20 '13 at 07:00
  • what's your question exactly? If you're already set to implement LruCache then there are not many optimizations you can do. The only thing you need to decide is the size of the cache. That depends on how heavy the rest of your application is, but a good place to start is your_available_heap / 8 – chopchop May 20 '13 at 07:22
  • @user1153991 third party libraries make your task easier. I suggest you use UIL or LazyList. http://stackoverflow.com/questions/15621936/whats-lazylist. If you insist on writing your own code check the link here http://developer.android.com/training/displaying-bitmaps/cache-bitmap.html – Raghunandan May 20 '13 at 07:33

4 Answers4

4

You can use the already available Universal Image Loader library. More info here : https://github.com/nostra13/Android-Universal-Image-Loader

nikhil.thakkar
  • 1,093
  • 7
  • 12
0

Take a look at http://www.youtube.com/watch?v=yhv8l9F44qo, google released a library that you can use for this.

bogdan
  • 782
  • 3
  • 7
0

you can use the cache path to do so.

  1. You can use HttpURLRequest to get the image data
  2. Use FileoutputStream to save image Context.getCacheDir();
  3. You can use image normally in Context.getCacheDir() + "/Imagename.png"

The file save in getCacheDir() will be auto release after the application is unload.

Read more information here: Context.html#getCacheDir()

Jeff Lee
  • 783
  • 9
  • 17
0

You can use this library : http://code.google.com/p/android-query/

If's license permits usage in both free and commercial apps, and is very easy to use. See examples in their app from Google play

Teshte
  • 624
  • 1
  • 7
  • 26