Kapil Rajput Kapil Rajput - 1 month ago 8
Android Question

How to Reload Image in Picasso?

I am using

Picasso
to load image in my application but i facing a issue that my image
URL
is same but image is changing from
backend
calling the same URL but
Picasso
loading the same image saved in its cache. Now i want to clear the cache for that Image and reload the image again.

What i have tried i searched on SO find that we can use
picasso.invalidate(fileName);
or
memoryPolicy(MemoryPolicy.NO_CACHE)
but i am getting the error message in code


Can't reslove method invalidate

Can't reslove method memoryPolicy


dependency for picasso in gradle :

compile 'com.squareup.picasso:picasso:2.4.0'

Answer

invalidate() and memoryPolicy() were introduced in later versions of the library. To use either of them update picasso to the latest version

compile 'com.squareup.picasso:picasso:2.5.2'