PagedList.Callback

public abstract class 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 dispatcher defined by PagedList.Builder.setNotifyDispatcher, which is generally the main/UI thread.

Summary

Public constructors

Public methods

abstract @NonNull void
onChanged(@NonNull int position, @NonNull 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 @NonNull void
onInserted(@NonNull int position, @NonNull int count)

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

abstract @NonNull void
onRemoved(@NonNull int position, @NonNull int count)

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

Public constructors

Callback

@NonNull
public final Callback()

Public methods

onChanged

@NonNull
public abstract @NonNull void onChanged(@NonNull int position, @NonNull 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
@NonNull int position

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

@NonNull int count

Number of items loaded.

onInserted

@NonNull
public abstract @NonNull void onInserted(@NonNull int position, @NonNull int count)

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

Parameters
@NonNull int position

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

@NonNull int count

Number of items loaded.

onRemoved

@NonNull
public abstract @NonNull void onRemoved(@NonNull int position, @NonNull 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
@NonNull int position

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

@NonNull int count

Number of items loaded.