Skip to content

Most visited

Recently visited



public class ListAdapterHelper
extends Object


This class is deprecated.
use AsyncListDiffer in the RecyclerView module, starting in 27.1.0. It is being moved from the Paging Library to RecyclerView since it is useful independent of paging.

Helper object for displaying a List in RecyclerView.Adapter, which signals the adapter of changes when the List is changed by computing changes with DiffUtil in the background.

For simplicity, the ListAdapter wrapper class can often be used instead of the helper directly. This helper class is exposed for complex cases, and where overriding an adapter base class to support List diffing isn't convenient.

The ListAdapterHelper can take a LiveData of List and present the data simply for an adapter. It computes differences in List contents via DiffUtil on a background thread as new Lists are received.

It provides a simple list-like API with getItem(int) and getItemCount() for an adapter to acquire and present data objects.


Public constructors

ListAdapterHelper(ListUpdateCallback listUpdateCallback, ListAdapterConfig<T> config)

Public methods

T getItem(int index)

Get the item from the current List at the specified index.

int getItemCount()

Get the number of items currently presented by this AdapterHelper.

void setList(List<T> newList)

Pass a new List to the AdapterHelper.

Inherited methods

From class java.lang.Object

Public constructors


ListAdapterHelper (ListUpdateCallback listUpdateCallback, 
                ListAdapterConfig<T> config)

listUpdateCallback ListUpdateCallback

config ListAdapterConfig

Public methods


T getItem (int index)

Get the item from the current List at the specified index.

index int: Index of item to get, must be >= 0, and < getItemCount().

T The item at the specified List position.


int getItemCount ()

Get the number of items currently presented by this AdapterHelper. This value can be directly returned to getItemCount().

int Number of items being presented.


void setList (List<T> newList)

Pass a new List to the AdapterHelper. Adapter updates will be computed on a background thread.

If a List is already present, a diff will be computed asynchronously on a background thread. When the diff is computed, it will be applied (dispatched to the ListUpdateCallback), and the new List will be swapped in.

newList List: The new List.

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields


Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience. (Dec 2017 Android Platform & Tools Survey)