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 come into view on the screen.
Is there a way to have Picasso pre-fetch the next N images in the list so that the experience is better? I am using an Adapter to put the images into the Gridview.
Image loading using Picasso is very easy, you can do it like this way Picasso. get(). load("http://i.imgur.com/DvpvklR.png").into(imageView); and in their website you can get every details.
Picasso is open source and one of the widely used image download libraries in Android. It is created and maintained by Square. It is among the powerful image download and caching library for Android. Picasso simplifies the process of loading images from external URLs and displays them on your application.
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();
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With