当前位置:网站首页>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;}}边栏推荐
- typescript27 - what about enumeration types
- 微信小程序用户登录auth.code2Session接口开发
- Selenium: upload and download files
- 2022.7.26 模拟赛
- [target detection] YOLOv7 theoretical introduction + practical test
- WPF入门项目必知必会-初步了解数据绑定 binding
- USB3.0:VL817Q7-C0的LAYOUT指南(二)
- In the shake database, I want to synchronize the data of the source db0 to the destination db5, how to set the parameters?
- 万字逐行解析与实现Transformer,并进行德译英实战(二)
- NUMPY
猜你喜欢
随机推荐
LeetCode 1189. “气球” 的最大数量
CSP-S2019 Day1
(2022 Nioke Duo School IV) H-Wall Builder II (Thinking)
Selenium:上传、下载文件
What should I do if the neural network cannot be trained?
剑指 Offer 68 - II. 二叉树的最近公共祖先
2022.7.26 模拟赛
pytorch、tensorflow对比学习—功能组件(激活函数、模型层、损失函数)
Challenge 52 days to memorize Peppa Pig (Day 01)
MySQL-Data Operation-Group Query-Join Query-Subquery-Pagination Query-Joint Query
(2022牛客多校四)K-NIO‘s Sword(思维)
pytroch、tensorflow对比学习—使用GPU训练模型
(2022牛客多校四)A-Task Computing (排序+动态规划)
混合型界面:对话式UI的未来
Logitech Mouse Experience Record
MySQL-DML语言-数据库操作语言-insert-update-delete-truncate
零序电流继电器器JL-8C-12-2-2
The solution to the inconsistency between the PaddleX deployment inference model and the GUI interface test results
Qt Widget 项目对qml的加载实例
类神经网络训练不起来怎么办









