android - Glide加载网络图片,显示之前的URL图片,换了URL图片还是没变
ringa_lee
ringa_lee 2017-04-17 17:30:40
0
3
662

Glide加载网络图片,显示之前的URL图片,换了URL图片还是没变

ringa_lee
ringa_lee

ringa_lee

reply all(3)
Peter_Zhu

I have also encountered this problem, because when Glide loads an image, it will cache the image locally. If the URL does not change, it will directly read the cache and not load it over the network.
There are two solutions:
1. Clear the cache every time you load. This is a very rubbish solution, which is equivalent to abandoning the very important function of caching.
2. The image address uses this: url+? random number. When the picture is changed, just change the random number in the background, so that you will reload the network picture locally. This is the fundamental solution, and the backend should be designed like this

巴扎黑

Recommend an open source framework for loading images from the network, Universal Image Loader, which is very convenient to use

洪涛

1. You need to cooperate with the server. When the request is returned, there must be expires in the header to indicate whether the resource has expired.
2. If the resource expires, clear the image cache and reload

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template