当前位置:网站首页>After the image is updated, Glide loading is still the original image problem
After the image is updated, Glide loading is still the original image problem
2022-08-01 05:19:00 【Talents and learning are shallow, hard work】
reason
Glide cannot update the image due to cache when loading the same URL
Workaround
1, remove cache
If it is a local image, you can cancel the cache, which is a relatively simple operation:
.skipMemoryCache(true) // don't use memory cache.diskCacheStrategy(DiskCacheStrategy.NONE) // don't use disk cache.into(imageView);
2, using signature
Regardless of the local image network image, another method can be used, that is to use Glide's method .signature(Key signature), by creating a signature, and then changing the signature when the image is updated to achieve the effect of reloading.The signature can be a String or the time when the image is updated
Glide.with(getActivity()).load(urlString).signature(new ObjectKey(DateTimeUtil.GetNowTime()))//You can also use system milliseconds System.currentTimeMillis().into(portrait);
Note: The new StringSignature() class in Glide 4.0 is no longer supported and needs to be changed to new ObjectKey()
Tools used
public class DateTimeUtil {public static String GetNowTime() {SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");Date curDate = new Date(System.currentTimeMillis());// Get the current timeString str = formatter.format(curDate);return str;}}
边栏推荐
- NDK does not contain any platforms问题解决
- Selenium:弹窗处理
- PaddleX部署推理模型和GUI界面测试结果不一致的解决方法
- 可持久化线段树
- vim configuration + ctag is as easy to read code as source insight
- Logitech Mouse Experience Record
- WPF项目-初步了解数据绑定 binding
- Optional parameters typescript19 - object
- Pyspark Machine Learning: Vectors and Common Operations
- HJS-DE1/2时间继电器
猜你喜欢
typescript28 - value of enumeration type and data enumeration
Selenium: Popup Handling
2022/07/29 入职健海JustFE团队,我学到了高效开发(年中总结)
(Codeforce 757) E. Bash Plays with Functions
Swastika line-by-line parsing and realization of the Transformer, and German translation practice (a)
PAT乙级 1002 写出这个数
About making a progress bar for software initialization for Qt
PaddleX部署推理模型和GUI界面测试结果不一致的解决方法
y83.第四章 Prometheus大厂监控体系及实战 -- prometheus告警机制进阶(十四)
WPF项目-初步了解数据绑定 binding
随机推荐
A,H,K,N
Selenium:元素定位
MySQL-Data Operation-Group Query-Join Query-Subquery-Pagination Query-Joint Query
Selenium:元素等待
Selenium: Introduction
万字逐行解析与实现Transformer,并进行德译英实战(二)
leetcode125 验证回文串
2022/07/29 入职健海JustFE团队,我学到了高效开发(年中总结)
图片更新之后Glide加载依旧是原来的图片问题
类神经网络训练不起来怎么办
PAT乙级 1001 害死人不偿命的(3n+1)猜想
LeetCode 27. 移除元素
状态压缩dp
Selenium: mouse, keyboard events
API Design Notes: The pimpl trick
MySQL-DML语言-数据库操作语言-insert-update-delete-truncate
LeetCode 387. 字符串中的第一个唯一字符
Excuse me, only primary key columns can be queried using sql in table storage. Does ots sql not support non-primary keys?
2022.7.27好题选讲
Selenium:浏览器操作