1

In the main activity of my app I cache a list of images using the Picasso library. Here is the code I am calling:

private void cacheImagesAndLoadToMemory() {
    for (City city : cities) {
        Picasso.with(MainMenuActivity.this).load(city.getImageUrl()).fetch();
    }
}

On the first launch the images will take some time to get saved into the app data but on the second launch this will be instantaneous because it will run through the loop and see that everything is already cached.

I need to know if there is a way to show the user the progress of caching this list of images on the first launch of the app. I'd like to use something like a progressbar but I've no idea how to link the progress of the image caching to a progressbar or a similar UI widget since the fetch() runs asynchronously.

nicoqueijo
  • 872
  • 2
  • 11
  • 28
  • tried this? https://stackoverflow.com/questions/24892820/how-to-use-progressbar-when-loading-image-in-picasso – akshay_shahane Sep 29 '17 at 21:48
  • instead of `fetch()` use [fetch(Callback)](http://square.github.io/picasso/2.x/picasso/com/squareup/picasso/RequestCreator.html#fetch-com.squareup.picasso.Callback-) – pskink Sep 30 '17 at 04:23

0 Answers0