android-smart-image-view
android-smart-image-view copied to clipboard
How can i disable using cache for super fast loading
When image in web-server changed,
Smart image view doesn't realize that changed.
I think, The reason is cache for super fast loading.
How can i disable using cache for super fast loading
or
realize changed-image.
I would like that functionnality too ! It would be great if we would be able to put the componant with two attributes: CACHE and NO-CACHE
You can clear the cache and it will reload the images from the server
WebImageCache cache = new WebImageCache(context); cache.clear();
So you could do it manually(I do mine when the user logs out) or you could do some sort of http request that checks if the image should be cleared.
You could also just use the source files in your program and remove all the cache calls.
Thanks for the answer ! :D I'll use the cache.clear() method ! Very useful if we need to refresh the picture from the server. I think this should be on the documentation !
Thanks !
Actually, I try to refresh the picture from the Internet. So here is my code: WebImageCache cache = new WebImageCache(getBaseContext()); cache.clear(); myImage2.setImageUrl(/* URL */);
But it does not work :s What is wrong ? :s
I noticed this also with my images in a list view even though I verified that my cache was empty. I believe that it is due to the way android recycles views so they aren't refreshed until I scroll down then back up.
You might try myImage2.img.setImageResource(0); to clear the image then myImage2.setImageUrl("http..."); to refresh it. you would still need to clear the cache though because otherwise it would keep filling up.
If your image is going to be changing every time you app needs it you would be better off just using the source code in your project and removing the cache calls(faster than dealing with clearing cache all the time).
edit: You can even for off this repo and create your own version without caching
Thanks ! :) I tried "myImage2.img.setImageResource(0);" , but it didn't worked. So I checked WebImage.java's code, and commented the two lines
"bitmap = webImageCache.get(url);" (line 32) and "webImageCache.put(url, bitmap);" (line 36),
and now it works !
Thanks a lot ! :) I hope this thread will help someone
FAIK, it will be getting images from external also isn't it?
WebImageCache cache = new WebImageCache(getActivity()); cache.clear(); Use this code inside the viewHolder where the data is populating.