Search code examples
androidandroid-activityandroid-recyclerviewpicassoback-stack

Avoid Remote Server call in recyclerview when returning back to an Activity


I have a recyclerview with images in Activity A, clicking on a button takes me to Activity B in which i have setDisplayHomeAsUpEnabled(true); so clicking on the UP button in toolbar goes back to Activity A but i do not want the recyclerview images to be fetched again from server only in this case (while returning from Activity B) in other cases i want it to load from remote server. I'm Using Picasso for loading the images.

Picasso.with(mContext).load(disposalType.getImage()).into(holder.thumbnail1);

Solution

  • AFAIK Picasso have memory cache enabled by default. So after returning back it will try to fetch images from memory cache. Or you can specify your own cache policy.