Skip to content Skip to sidebar Skip to footer

Getting Picasso To Pre-fetch Forthcoming Images

I'm using Picasso with a GridView, loading 200 images over the network. Right now it looks like Picasso is not triggering an image load over the network until the image starts to c

Solution 1:

I am prefetching images into a cache very successfully using Picasso like so:

if (BuildConfig.DEBUG) {
     Picasso.with(getApplicationContext()).setIndicatorsEnabled(true);
     Picasso.with(getApplicationContext()).setLoggingEnabled(true);
}
for (Article article : articleList) {
     ArrayList<String> images = article.getImages();
     for (String url : images) {
          if (!TextUtils.isEmpty(url)) {
               Picasso.with(getApplicationContext())
                    .load(url)
                    .resizeDimen(R.dimen.article_image_preview_width, R.dimen.article_image_preview_height)
                    .centerCrop()
                    .fetch();
          }
     }
}

Post a Comment for "Getting Picasso To Pre-fetch Forthcoming Images"