I have an array of all the URIs of the images which I am showing in a List. Now I want to run a thread in background which gets this images from web and store them on the SD card. So when I click a particular element in the list instead of fetching from web it should fetch from the SD card in the new activity.
How do I do this?
You could try using my lazy-drawables framework (GPL v3 licensed):
https://github.com/rtyley/lazy-drawables
-unfortunately it's not quite ready for production yet, but among the things it attempts to handle:
...once you have a lazy-drawable session set up, populating an image view is as easy as:
Drawable avatarDrawable = imageSession.get(someUserIdentifier); // doesn't block
imageView.setImageDrawable(avatarDrawable);
You don't care that it may have immediately returned you a normal bitmapdrawable, or possibly spawned an async task and returned a placeholder drawable - the drawable will update itself and it's host ImageView when the async task has completed.
That's the theory anyway. It seems to sorta-kinda work so far, but sometimes that spontaneous UI update doesn't happen... not sure why :-}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With