9

I am using the Picasso library on my Android app to load images. I would like to add an option called "Clear images cache" on my app that would remove all the downloaded images from the cache, but obviously that would remove the downloaded images from my app only (I mean not from the other apps).

Is there a simple way to do that using Picasso? Using a native component?

Thanks!

thomaus
  • 5,780
  • 8
  • 42
  • 62

2 Answers2

12

You can clear in-memory cache in Picasso only per image:

Picasso.with(context).invalidate(imagePath);

Removing all cache is somewhat tricky and described here.

File cache is delegated to HTTP Client, so it's not possible to clear it from Picasso. For more information refer this answer.

Community
  • 1
  • 1
Ayzen
  • 823
  • 7
  • 10
0

Try this line of code given below, this removes the resource inside ImageView.

Picasso.with(context).setImageResource(0);
jkdev
  • 9,037
  • 14
  • 52
  • 75
Md. Rejaul Karim
  • 473
  • 5
  • 11