I use Volley NetworkImageView
to download images from internet and show in my listview
. Now I want to make Volley NetworkImageView
show sa
If I understand you correctly, you would benefit if the memory cache provided to the ImageLoader
class that's used by your NetworkImageView
will be persisted between app runs, without losing the fact that it's a memory cache.
That memory cache keeps the correctly sized bitmap in normal operation - which you would like available even if the network goes down.
So here's an idea: every time you're app is closed, persist on file the images from the cache. The next time you load your app, when you create the memory cache - check for a persisted version on the disk, and if it's available - populate the memory cache from the disk.
There are several approaches you can take to decide when to persist an image and when to delete it.
Here's one approach: create a hybrid memory / disk cache. It would work exactly the same as your memory cache works now with the following differences:
putBitmap()
is called, along with your normal operation, save an encoded version of the bitmap to the disk in a background thread / AsyncTask
.AsyncTask
.You can't avoid decoding the bitmaps, however you can cut the size and having to deal with resizing large bitmaps.
Does this help you?