Force image re-download using Picasso

I am creating an application that will download an image from a specific URL and display it on an ImageView. The server changes this image over time, but the URL remains unchanged. So I want to implement this logic:

  • When the application is rotated or reopened, load the image from the application cache
  • When the user clicks the download button, the image must be re-downloaded from the network and replace the cache

How to implement this approach with Picasso? Or maybe some other library is better?

+4
source share
1 answer
Picasso.with(context)
    .load(url)
    .memoryPolicy(MemoryPolicy.NO_CACHE)
    .networkPolicy(NetworkPolicy.NO_CACHE)
    .fit()
    .centerCrop()
    .into(imageView);

NO_CACHE , . .

+16

All Articles