Skip to content

Most visited

Recently visited

navigation

DiffCallback

public abstract class DiffCallback
extends Object

java.lang.Object
   ↳ android.support.v7.recyclerview.extensions.DiffCallback<T>


Callback that informs PagedListAdapterHelper how to compute list updates when using DiffUtil on a background thread.

The AdapterHelper will pass items from different lists to this callback in order to implement the DiffUtil.Callback it uses to compute differences between lists.

Note that this class is likely to move prior to the final release of the Paging library.

Summary

Public constructors

DiffCallback()

Public methods

abstract boolean areContentsTheSame(T oldItem, T newItem)

Called to decide whether two items have the same data.

abstract boolean areItemsTheSame(T oldItem, T newItem)

Called to decide whether two objects represent the same item.

Object getChangePayload(T oldItem, T newItem)

Called to get a change payload between an old and new version of an item.

Inherited methods

From class java.lang.Object

Public constructors

DiffCallback

DiffCallback ()

Public methods

areContentsTheSame

boolean areContentsTheSame (T oldItem, 
                T newItem)

Called to decide whether two items have the same data. This information is used to detect if the contents of an item have changed.

Parameters
oldItem T: The item in the old list.

newItem T: The item in the new list.

Returns
boolean True if the contents of the items are the same or false if they are different.

See also:

areItemsTheSame

boolean areItemsTheSame (T oldItem, 
                T newItem)

Called to decide whether two objects represent the same item.

Parameters
oldItem T: The item in the old list.

newItem T: The item in the new list.

Returns
boolean True if the two items represent the same object or false if they are different.

See also:

getChangePayload

Object getChangePayload (T oldItem, 
                T newItem)

Called to get a change payload between an old and new version of an item.

Parameters
oldItem T

newItem T

Returns
Object

See also:

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

Hooray!

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.
(Sep 2017 survey)