Search code examples
androidpicasso

Picasso always showing old image not the new one from one particular URL


Using Picasso to load image from one particular URL, but always showing old image, not the new one

Picasso.get()
  .load("https://blabla.com/image/rose.png")
  .networkPolicy(NetworkPolicy.NO_CACHE, NetworkPolicy.NO_STORE)
  .into(image_view)

dependency

implementation 'com.squareup.picasso:picasso:2.71828'

Solution

  • Heyy,

    So you have to just put these lines

    Picasso.with(context).load(imageUrl)
                .error(R.drawable.error)
                .placeholder(R.drawable.placeholder)
                .memoryPolicy(MemoryPolicy.NO_CACHE, MemoryPolicy.NO_STORE)
                .into(imageView);
    

    Edit

    Add .stableKey(url) in picasso

    And then when loading the image again call this method

    Picasso.with(getContext()).invalidate(url);
    

    And that's done