Recyclerview Painfully Slow to Load Cached Images Form Picasso

Picasso isn't loading scrolled images efficiently?

First of all I suggest you to use RecyclerView with GridLayoutManager or StaggeredGridLayoutManager. It must be more effective and view itself contain less bugs.

Next, use OkHttp with Picasso. It's more stable, powerful and consistent http client. And I think most important to you configure memory/file cache.

// Create a cache using an appropriate portion of the available RAM
Cache memoryCache = new LruCache(getApplicationContext());

// Use OkHttp as downloader
Downloader downloader = new OkHttpDownloader(getApplicationContext(),
PICASSO_DISK_CACHE_SIZE);

mPicasso = new Picasso.Builder(getApplicationContext())
.downloader(downloader).memoryCache(memoryCache).build();

Speed of loading also depend on network condition and image size.

Picasso Taking time to load images

fit() needs to wait for the size of the ImageView to be determined before it can size the image to match, and the size can't be calculated until the end of the layout pass. You might get quicker results by using resize() if you are able to predict reasonable width and height values.

You might also want to look at the Glide library as it takes a different approach to caching that can be quicker than Picasso in some cases, for example instead of caching full size images it caches the resized ones. However, there are many pros and cons to both libraries; although the syntaxes are very similar, some things that work in Picasso will not work in Glide, and vice versa.



Related Topics



Leave a reply



Submit