How can I update the mural image of SimpleDraweeView if it was installed once by setImageURI

I use the Fresco Facebook library and SimpleDraweeView to display an avatar image from a file:

Uri avaURI = Uri.fromFile(new File(getCacheDir(), Constants.AVA_FILE_NAME)); simpleDrawee.setImageURI(avaURI); 

But what if I changed the image file (deleted the previous file and created the same one with the new image), how can I update (update) SimpleDraweeView? It still displays the old version of the image (I tried to disable the Fresco.getImagePipeline().evictFromMemoryCache(avaURI); cache, but that didn't help).

+6
source share
2 answers

I believe that you are on the right track. There are two more storage levels where the old image may exist, where it most likely gets rolled back. I believe that they will expire after 60 days, so they will also need to be cleaned.

 Fresco.getImagePipeline().evictFromMemoryCache(avaURI); Fresco.getImagePipelineFactory().getMainDiskStorageCache().remove(new SimpleCacheKey(avaURI.toString())); Fresco.getImagePipelineFactory().getSmallImageDiskStorageCache().remove(new SimpleCacheKey(avaURI.toString())); 
+12
source
 ImagePipeline imagePipeline = Fresco.getImagePipeline(); imagePipeline.evictFromCache(Uri); imagePipeline.clearCaches(); draweeView.setImageURI(Uri); 
+1
source

Source: https://habr.com/ru/post/987920/


All Articles