I'm trying to clear the cache memory of Picasso via Android coding.
Can anyone please help me in this issue..?
I have tried using the following code, but this was not useful in my case:
Picasso.with(getActivity()).load(data.get(pos).getFeed_thumb_image()).skipMemoryCache().into(image);
Use this instead :
Picasso.with(getContext()).load(data.get(pos).getFeed_thumb_image()).memoryPolicy(MemoryPolicy.NO_CACHE).into(image);
Remove cache of Picasso like this.
public class Clear {
public static void clearCache (Picasso p) {
p.cache.clear();
}
}
This util class can clear the cache for you. You just have to call it:
Clear.clearCache(Picasso.with(context));
EDIT:
The class Clear must be in the package :
package com.squareup.picasso;
Because cache is not accessible from outside that package. Like in this answer: https://stackoverflow.com/a/23544650/4585226
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With