Android 12 Developer Preview is here! Try it out, and give us your feedback!

PagingDataAdapter

class PagingDataAdapter<T : Any> : ObjectAdapter
kotlin.Any
   ↳ androidx.leanback.widget.ObjectAdapter
   ↳ androidx.leanback.paging.PagingDataAdapter

An ObjectAdapter implemented with an AsyncPagingDataDiffer. It is an analogue of androidx.paging.PagingDataAdapter for leanback widgets.

Summary

Public constructors
<init>(diffCallback: DiffUtil.ItemCallback<T>, mainDispatcher: CoroutineDispatcher = Dispatchers.Main, workerDispatcher: CoroutineDispatcher = Dispatchers.Default)

Constructs an adapter

<init>(presenter: Presenter, diffCallback: DiffUtil.ItemCallback<T>, mainDispatcher: CoroutineDispatcher = Dispatchers.Main, workerDispatcher: CoroutineDispatcher = Dispatchers.Default)

Constructs an adapter

<init>(presenterSelector: PresenterSelector, diffCallback: DiffUtil.ItemCallback<T>, mainDispatcher: CoroutineDispatcher = Dispatchers.Main, workerDispatcher: CoroutineDispatcher = Dispatchers.Default)

Constructs an adapter

Public methods
Unit

Add a CombinedLoadStates listener to observe the loading state of the current PagingData.

T?
get(position: Int)

Returns the item for the given position.

Unit

Refresh the data presented by this PagingDataAdapter.

Unit

Remove a previously registered CombinedLoadStates listener.

Unit

Retry any failed load requests that would result in a LoadState.Error update to this

Int

suspend Unit
submitData(pagingData: PagingData<T>)

Present a PagingData until it is invalidated by a call to refresh or PagingSource.invalidate.

Unit
submitData(lifecycle: Lifecycle, pagingData: PagingData<T>)

Present a PagingData until it is either invalidated or another call to submitData is made.

Inherited functions