简体   繁体   中英

How to inform the app that an image that was already downloaded and cached, was updated/changed on the server and needs to be Re-downloaded?

How to inform the app that an image that was already downloaded and cached, was updated/changed on the server and needs to be Re-downloaded?

I have a ListView on my app that downloads the images and caches them so they wont have to be loaded again and again.

The problem is that when I edit or change the image on the server, the image on the app stays the same, because it is cached. it uses the image URL.

In other words, the code checks whether that URL was already used to download that image, and if it does, he pulls it out of the cache and displays it. else - it downloads it.

How can I inform the app, that there is a new image?

I mean, is there any common way to do that in my situation?

You can add a "Re-download" button, or something similar, that re-downloads the image and replaces the old one, it's the easiest way.

Another thing you can do, is check online every time if images are correct (you can have a value "version" that checks if images are current version), if an image is older version, download a new one.

I prefer the first version, it's way easier, but it's your pick :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM