Callback

abstract class Callback
kotlin.Any
   ↳ 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 Builder#setNotifyExecutor(Executor), which is generally the main/UI thread.

Summary

Public constructors

Callback signaling when content is loaded into the list.

Public methods

abstract Unit
onChanged(position: Int, count: Int)

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 Unit
onInserted(position: Int, count: Int)

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

abstract Unit
onRemoved(position: Int, count: Int)

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

Public constructors

<init>

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 Builder#setNotifyExecutor(Executor), which is generally the main/UI thread.

Public methods

onChanged

abstract fun onChanged(position: Int, count: Int): Unit

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

abstract fun onInserted(position: Int, count: Int): Unit

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

abstract fun onRemoved(position: Int, count: Int): Unit

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.