added in version 2.0.0
belongs to Maven artifact androidx.paging:paging-common:2.0.0-beta01

PagedList.Callback

public static abstract class PagedList.Callback
extends Object

java.lang.Object
   ↳ androidx.paging.PagedList.Callback


Callback signaling when content is loaded into the list.

Can be used to listen to items being paged in and out. These calls will be dispatched on the executor defined by PagedList.Builder.setNotifyExecutor(Executor), which is generally the main/UI thread.

Summary

Public constructors

PagedList.Callback()

Public methods

abstract void onChanged(int position, int count)

Called when null padding items have been loaded to signal newly available data, or when data that hasn't been used in a while has been dropped, and swapped back to null.

abstract void onInserted(int position, int count)

Called when new items have been loaded at the end or beginning of the list.

abstract void onRemoved(int position, int count)

Called when items have been removed at the end or beginning of the list, and have not been replaced by padded nulls.

Inherited methods

Public constructors

PagedList.Callback

added in version 2.0.0
public PagedList.Callback ()

Public methods

onChanged

added in version 2.0.0
public abstract void onChanged (int position, 
                int count)

Called when null padding items have been loaded to signal newly available data, or when data that hasn't been used in a while has been dropped, and swapped back to null.

Parameters
position int: Position of first newly loaded items, out of total number of items (including padded nulls).

count int: Number of items loaded.

onInserted

added in version 2.0.0
public abstract void onInserted (int position, 
                int count)

Called when new items have been loaded at the end or beginning of the list.

Parameters
position int: Position of the first newly loaded item (in practice, either 0 or size - 1.

count int: Number of items loaded.

onRemoved

added in version 2.0.0
public abstract void onRemoved (int position, 
                int count)

Called when items have been removed at the end or beginning of the list, and have not been replaced by padded nulls.

Parameters
position int: Position of the first newly loaded item (in practice, either 0 or size - 1.

count int: Number of items loaded.