Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

With RecyclerView, is Picasso still necessary?

Moving over form iOS recently, I realised that to handle fast scrolling of 100s of large images,

it's quite a bit of work and in practice you need to use Picasso (or maybe Volley).

Now that RecyclerView is here - has anyone implemented scrolling of many of large images, using RecyclerView ?

If so, do you have to use Picasso like in the old days (i.e, last week)

Any findings on this? Cheers

like image 917
Fattie Avatar asked Jun 28 '14 20:06

Fattie


1 Answers

RecyclerView is nothing more than an improved, more modular and extensible version of the AbsListView class. It provides a better API for recycling Views, and provides a way to create all sorts of list views with the same API's - vertical, horizontal, grid, staggered grid, and so on. Loading images is not at all part of this API.

Therefore, loading images into it requires you to do exactly the same as you did before. For example, using Picasso:

@Override
public void onBindViewHolder(final MyViewHolder myViewHolder, final int i) {
    Picasso.withContext(mContext).load(myImageUrl).into(myViewHolder.imageView);
}

In fact, coming back to your point:

RecyclerView is Android improving list view, so that we can get smoother scrolling of large lists of large images

I highly doubt that performance will increase if you already implemented the ListAdapter the right way: using ViewHolder classes, and properly reuse the convertView. The RecyclerView ships these optimizations by default, so you don't have to anymore.

like image 76
nhaarman Avatar answered Oct 05 '22 12:10

nhaarman