我正在使用https://source.unsplash.com/daily?nature的幻灯片将图像加载到我的应用程序
它是一个免费使用图像平台,上面的链接每天更新图像。
然而,幻灯片显示的是旧缓存的图像,即使图像已经更新在网站上。
所用代码:
Glide.with(this)
.load("https://source.unsplash.com/daily?nature")
.into(imageView);幻灯片版本: 4.0.0
发布于 2018-02-12 05:38:18
public static void loadImageWithGlide(Context theCtx, ImageView theImageView, String theUrl) {
// skipMemoryCache true, because it load the same image from cache when URL not change.
Glide.with(theCtx)
.load(theUrl)
.diskCacheStrategy(DiskCacheStrategy.NONE)
.skipMemoryCache(true)
.fitCenter()
.into(theImageView);
// use below lines, to enable memory cache. so that image does not load again ones loaded
//.diskCacheStrategy(DiskCacheStrategy.ALL)
//.skipMemoryCache(false)
}发布于 2018-02-12 04:19:21
这样改变你的代码。
Glide.with(this)
.load("https://source.unsplash.com/daily?nature")
.signature(new StringSignature(yourVersionMetadata))
.into(imageView);希望它能解决你的问题。有关更多信息,请参见这里。
发布于 2018-02-12 04:25:54
如果您的URL和catch在glid中是正确的,那么它将从catch加载图像,并且您选择了第一天,而且我知道您只想从一个URL加载图像
溶液
只需先做一件事,如果你的图像加载在一天内第一次调用,然后捕捉内存,然后在加载你的图像之后,设置一个条件。
if(isTHisyourFirstDay){
Glide.get(getApplicationContext()).clearMemory();
}
Glide.with(this)
.load("https://source.unsplash.com/daily?nature")
.into(imageView);https://stackoverflow.com/questions/48739425
复制相似问题