GithubHelp home page GithubHelp logo

Comments (8)

quentin-st avatar quentin-st commented on May 27, 2024

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

from android-smart-image-view.

meynet avatar meynet commented on May 27, 2024

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.

from android-smart-image-view.

quentin-st avatar quentin-st commented on May 27, 2024

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 !

from android-smart-image-view.

quentin-st avatar quentin-st commented on May 27, 2024

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

from android-smart-image-view.

meynet avatar meynet commented on May 27, 2024

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

from android-smart-image-view.

quentin-st avatar quentin-st commented on May 27, 2024

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

from android-smart-image-view.

ricardo-nakayama-movile avatar ricardo-nakayama-movile commented on May 27, 2024

FAIK, it will be getting images from external also isn't it?

from android-smart-image-view.

rajeesh7 avatar rajeesh7 commented on May 27, 2024

WebImageCache cache = new WebImageCache(getActivity());
cache.clear();
Use this code inside the viewHolder where the data is populating.

from android-smart-image-view.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.