问题描述
我使用facebook Fresco库和SimpleDraweeView显示文件中的头像图片:
I am using facebook Fresco library and SimpleDraweeView for displaying avatar image from file :
Uri avaURI = Uri.fromFile(new File(getCacheDir(), Constants.AVA_FILE_NAME));
simpleDrawee.setImageURI(avaURI);
但如果我用图片更改了文件(删除了以前的文件,并用新图像创建了相同的文件) ,我该如何更新(刷新)SimpleDraweeView?它仍然显示旧版本的图像。(我试图通过 Fresco.getImagePipeline()来禁用缓存.evictFromMemoryCache(avaURI);
但它没有帮助。)
But what if i changed file with picture(deleted previous file and created the same one with new image),how can i update(refresh) SimpleDraweeView? Its still display the old version of image.(I tried to disable cache by Fresco.getImagePipeline().evictFromMemoryCache(avaURI);
but it didn't help).
推荐答案
我相信你走在了正确的轨道上。旧图像可能存在两个以上的存储级别,其中最有可能从中拉回。它们会在60天后过期,我相信它也需要刷新。
I believe you were on the right track. There are two more levels of storage that the old image may exist in, where it is most likely getting pull back in from. These expire after 60 days, I believe, so it will need to be flushed also.
Fresco.getImagePipeline().evictFromMemoryCache(avaURI);
Fresco.getImagePipelineFactory().getMainDiskStorageCache().remove(new SimpleCacheKey(avaURI.toString()));
Fresco.getImagePipelineFactory().getSmallImageDiskStorageCache().remove(new SimpleCacheKey(avaURI.toString()));
这篇关于我如何更新壁画SimpleDraweeView的图像,如果它由setImageURI设置一次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!