0

I am using ImageGallery to display some images in my app, in this example the images are being saved (cached), and I dont want them to be so I have found that the images are loaded in on this adapter class Adapter with this code

private void setUpImage(ImageView iv, String imageUrl) {
    if (!TextUtils.isEmpty(imageUrl)) {
        Picasso.with(iv.getContext())
                .load(imageUrl)
                .resize(mGridItemWidth, mGridItemHeight)
                .centerCrop()
                .into(iv);
    } else {
        iv.setImageDrawable(null);
    }
}

Which is called every time the gallery is displayed, what I can't figure out is why they do not get reloaded if you go back to this page?

How can I make so that every time this page load the images are reloaded?

Thanks

iqueqiorio
  • 1,149
  • 2
  • 35
  • 78
  • Picasso caches the images, you should clear the cache with `Picasso.with(context).invalidate();` after this, the images should be fetched from the url again (instead of from cache). – Mdlc Dec 13 '15 at 15:28
  • @Mdlc thank you very much, and should this code go at the end of the load? Im also get a compile error `cannot resolve invalidate()`? What should go inside? – iqueqiorio Dec 13 '15 at 15:29
  • You should call this before making a new load (e.g. if you reload the list from onResume() you would first call .invalidate() on picasso) – Mdlc Dec 13 '15 at 15:31
  • @Mdlc okay and what does in the `()` of invalidate it says it take a `path`, `file` or `URI`? – iqueqiorio Dec 13 '15 at 15:33
  • 2
    You're right, my code only applied to a previous version of the library. Check the following answer instead: http://stackoverflow.com/a/23544650/1683141 – Mdlc Dec 13 '15 at 15:35

0 Answers0