# PagingDataAdapter

Artifact: [androidx.leanback:leanback-paging](https://developer.android.com/jetpack/androidx/releases/leanback) [View Source](https://cs.android.com/search?q=file:androidx/leanback/paging/PagingDataAdapter.kt+class:androidx.leanback.paging.PagingDataAdapter) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

*** ** * ** ***

<br />

```
public final class PagingDataAdapter<T extends Object> extends ObjectAdapter
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [androidx.leanback.widget.ObjectAdapter](https://developer.android.com/reference/androidx/leanback/widget/ObjectAdapter) ||
|   | ↳ | [androidx.leanback.paging.PagingDataAdapter](https://developer.android.com/reference/androidx/leanback/paging/PagingDataAdapter) |

*** ** * ** ***

An `https://developer.android.com/reference/androidx/leanback/widget/ObjectAdapter` implemented with an `https://developer.android.com/reference/androidx/paging/AsyncPagingDataDiffer`. It is an analogue of `https://developer.android.com/reference/androidx/paging/PagingDataAdapter` for leanback widgets.

| Parameters |
|---|---|
| `<T extends https://developer.android.com/reference/java/lang/Object.html>` | Type of the item in the list. |

## Summary

| ### Public constructors |
|---|
| `<T extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/leanback/paging/PagingDataAdapter#PagingDataAdapter(androidx.recyclerview.widget.DiffUtil.ItemCallback,kotlinx.coroutines.CoroutineDispatcher,kotlinx.coroutines.CoroutineDispatcher)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/DiffUtil.ItemCallback<@https://developer.android.com/reference/androidx/annotation/NonNull T> diffCallback, @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html mainDispatcher, @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html workerDispatcher )` Constructs an adapter |
| `<T extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/leanback/paging/PagingDataAdapter#PagingDataAdapter(androidx.leanback.widget.Presenter,androidx.recyclerview.widget.DiffUtil.ItemCallback,kotlinx.coroutines.CoroutineDispatcher,kotlinx.coroutines.CoroutineDispatcher)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/leanback/widget/Presenter presenter, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/DiffUtil.ItemCallback<@https://developer.android.com/reference/androidx/annotation/NonNull T> diffCallback, @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html mainDispatcher, @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html workerDispatcher )` Constructs an adapter |
| `<T extends https://developer.android.com/reference/java/lang/Object.html> https://developer.android.com/reference/androidx/leanback/paging/PagingDataAdapter#PagingDataAdapter(androidx.leanback.widget.PresenterSelector,androidx.recyclerview.widget.DiffUtil.ItemCallback,kotlinx.coroutines.CoroutineDispatcher,kotlinx.coroutines.CoroutineDispatcher)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/leanback/widget/PresenterSelector presenterSelector, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/DiffUtil.ItemCallback<@https://developer.android.com/reference/androidx/annotation/NonNull T> diffCallback, @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html mainDispatcher, @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html workerDispatcher )` Constructs an adapter |

| ### Public methods |
|---|---|
| `final void` | `https://developer.android.com/reference/androidx/leanback/paging/PagingDataAdapter#addLoadStateListener(kotlin.Function1)( @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/CombinedLoadStates, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> listener )` Add a `https://developer.android.com/reference/androidx/paging/CombinedLoadStates` listener to observe the loading state of the current `https://developer.android.com/reference/androidx/paging/PagingData`. |
| `T` | `https://developer.android.com/reference/androidx/leanback/paging/PagingDataAdapter#get(kotlin.Int)(int position)` Returns the item for the given position. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/CombinedLoadStates>` | `https://developer.android.com/reference/androidx/leanback/paging/PagingDataAdapter#getLoadStateFlow()()` A hot `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html` of `https://developer.android.com/reference/androidx/paging/CombinedLoadStates` that emits a snapshot whenever the loading state of the current `https://developer.android.com/reference/androidx/paging/PagingData` changes. |
| `final T` | `https://developer.android.com/reference/androidx/leanback/paging/PagingDataAdapter#peek(kotlin.Int)(@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int index)` Returns the presented item at the specified position, without notifying Paging of the item access that would normally trigger page loads. |
| `final void` | `https://developer.android.com/reference/androidx/leanback/paging/PagingDataAdapter#refresh()()` Refresh the data presented by this `https://developer.android.com/reference/androidx/leanback/paging/PagingDataAdapter`. |
| `final void` | `https://developer.android.com/reference/androidx/leanback/paging/PagingDataAdapter#removeLoadStateListener(kotlin.Function1)( @https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/CombinedLoadStates, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> listener )` Remove a previously registered `https://developer.android.com/reference/androidx/paging/CombinedLoadStates` listener. |
| `final void` | `https://developer.android.com/reference/androidx/leanback/paging/PagingDataAdapter#retry()()` Retry any failed load requests that would result in a `https://developer.android.com/reference/androidx/paging/LoadState.Error` update to this |
| `int` | `https://developer.android.com/reference/androidx/leanback/paging/PagingDataAdapter#size()()` |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/ItemSnapshotList<@https://developer.android.com/reference/androidx/annotation/NonNull T>` | `https://developer.android.com/reference/androidx/leanback/paging/PagingDataAdapter#snapshot()()` Returns a new `https://developer.android.com/reference/androidx/paging/ItemSnapshotList` representing the currently presented items, including any placeholders if they are enabled. |
| `final void` | `https://developer.android.com/reference/androidx/leanback/paging/PagingDataAdapter#submitData(androidx.paging.PagingData)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PagingData<@https://developer.android.com/reference/androidx/annotation/NonNull T> pagingData)` Present a `https://developer.android.com/reference/androidx/paging/PagingData` until it is invalidated by a call to `https://developer.android.com/reference/androidx/leanback/paging/PagingDataAdapter#refresh()` or `https://developer.android.com/reference/androidx/paging/PagingSource#invalidate()`. |
| `final void` | `https://developer.android.com/reference/androidx/leanback/paging/PagingDataAdapter#submitData(androidx.lifecycle.Lifecycle,androidx.paging.PagingData)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/lifecycle/Lifecycle lifecycle, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/PagingData<@https://developer.android.com/reference/androidx/annotation/NonNull T> pagingData )` Present a `https://developer.android.com/reference/androidx/paging/PagingData` until it is either invalidated or another call to `https://developer.android.com/reference/androidx/leanback/paging/PagingDataAdapter#submitData(androidx.lifecycle.Lifecycle,androidx.paging.PagingData)` is made. |

### Inherited methods

From [androidx.leanback.widget.ObjectAdapter](https://developer.android.com/reference/androidx/leanback/widget/ObjectAdapter) `long` `https://developer.android.com/reference/androidx/leanback/widget/ObjectAdapter#getId(int)(int position)`

Returns the id for the given position.
`final @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/leanback/widget/Presenter` `https://developer.android.com/reference/androidx/leanback/widget/ObjectAdapter#getPresenter(java.lang.Object)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/Object.html item)`

Returns the `https://developer.android.com/reference/androidx/leanback/widget/Presenter` for the given item from the adapter.
`final @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/leanback/widget/PresenterSelector` `https://developer.android.com/reference/androidx/leanback/widget/ObjectAdapter#getPresenterSelector()()` `final boolean` `https://developer.android.com/reference/androidx/leanback/widget/ObjectAdapter#hasStableIds()()`

Returns true if the item ids are stable across changes to the underlying data.
`boolean` `https://developer.android.com/reference/androidx/leanback/widget/ObjectAdapter#isImmediateNotifySupported()()` `final void` `https://developer.android.com/reference/androidx/leanback/widget/ObjectAdapter#notifyChanged()()`

Notifies UI that the underlying data has changed.
`final void` `https://developer.android.com/reference/androidx/leanback/widget/ObjectAdapter#notifyItemMoved(int,int)(int fromPosition, int toPosition)`

Notifies UI that item at fromPosition has been moved to toPosition.
`final void` `https://developer.android.com/reference/androidx/leanback/widget/ObjectAdapter#notifyItemRangeChanged(int,int)(int positionStart, int itemCount)`

Notifies UI that some items has changed.
`final void` `https://developer.android.com/reference/androidx/leanback/widget/ObjectAdapter#notifyItemRangeChanged(int,int,java.lang.Object)(

int positionStart,

int itemCount,

@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Object.html payload

)`

Notifies UI that some items has changed.
`final void` `https://developer.android.com/reference/androidx/leanback/widget/ObjectAdapter#notifyItemRangeInserted(int,int)(int positionStart, int itemCount)`

Notifies UI that new items has been inserted.
`final void` `https://developer.android.com/reference/androidx/leanback/widget/ObjectAdapter#notifyItemRangeRemoved(int,int)(int positionStart, int itemCount)`

Notifies UI that some items that has been removed.
`void` `https://developer.android.com/reference/androidx/leanback/widget/ObjectAdapter#onHasStableIdsChanged()()`

Called when `https://developer.android.com/reference/androidx/leanback/widget/ObjectAdapter#setHasStableIds(boolean)` is called and the status of stable ids has changed.
`void` `https://developer.android.com/reference/androidx/leanback/widget/ObjectAdapter#onPresenterSelectorChanged()()`

Called when `https://developer.android.com/reference/androidx/leanback/widget/ObjectAdapter#setPresenterSelector(androidx.leanback.widget.PresenterSelector)` is called and the PresenterSelector differs from the previous one.
`final void` `https://developer.android.com/reference/androidx/leanback/widget/ObjectAdapter#registerObserver(androidx.leanback.widget.ObjectAdapter.DataObserver)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/leanback/widget/ObjectAdapter.DataObserver observer)`

Registers a DataObserver for data change notifications.
`final void` `https://developer.android.com/reference/androidx/leanback/widget/ObjectAdapter#setHasStableIds(boolean)(boolean hasStableIds)`

Sets whether the item ids are stable across changes to the underlying data.
`final void` `https://developer.android.com/reference/androidx/leanback/widget/ObjectAdapter#setPresenterSelector(androidx.leanback.widget.PresenterSelector)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/leanback/widget/PresenterSelector presenterSelector)` `final void` `https://developer.android.com/reference/androidx/leanback/widget/ObjectAdapter#unregisterAllObservers()()`

Unregisters all DataObservers for this ObjectAdapter.
`final void` `https://developer.android.com/reference/androidx/leanback/widget/ObjectAdapter#unregisterObserver(androidx.leanback.widget.ObjectAdapter.DataObserver)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/leanback/widget/ObjectAdapter.DataObserver observer)`

Unregisters a DataObserver for data change notifications.

## Public constructors

### PagingDataAdapter

```
public <T extends Object> PagingDataAdapter(
    @NonNull DiffUtil.ItemCallback<@NonNull T> diffCallback,
    @NonNull CoroutineDispatcher mainDispatcher,
    @NonNull CoroutineDispatcher workerDispatcher
)
```

Constructs an adapter

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/DiffUtil.ItemCallback<@https://developer.android.com/reference/androidx/annotation/NonNull T> diffCallback` | The `https://developer.android.com/reference/androidx/recyclerview/widget/DiffUtil.ItemCallback` instance to compare items in the list. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html mainDispatcher` | The `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html` to be used for foreground operations |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html workerDispatcher` | The `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html` to be used for computing diff |

### PagingDataAdapter

```
public <T extends Object> PagingDataAdapter(
    @NonNull Presenter presenter,
    @NonNull DiffUtil.ItemCallback<@NonNull T> diffCallback,
    @NonNull CoroutineDispatcher mainDispatcher,
    @NonNull CoroutineDispatcher workerDispatcher
)
```

Constructs an adapter

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/leanback/widget/Presenter presenter` | `https://developer.android.com/reference/androidx/leanback/widget/Presenter` |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/DiffUtil.ItemCallback<@https://developer.android.com/reference/androidx/annotation/NonNull T> diffCallback` | The `https://developer.android.com/reference/androidx/recyclerview/widget/DiffUtil.ItemCallback` instance to compare items in the list. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html mainDispatcher` | The `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html` to be used for foreground operations |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html workerDispatcher` | The `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html` to be used for computing diff |

### PagingDataAdapter

```
public <T extends Object> PagingDataAdapter(
    @NonNull PresenterSelector presenterSelector,
    @NonNull DiffUtil.ItemCallback<@NonNull T> diffCallback,
    @NonNull CoroutineDispatcher mainDispatcher,
    @NonNull CoroutineDispatcher workerDispatcher
)
```

Constructs an adapter

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/leanback/widget/PresenterSelector presenterSelector` | `https://developer.android.com/reference/androidx/leanback/widget/PresenterSelector` |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/recyclerview/widget/DiffUtil.ItemCallback<@https://developer.android.com/reference/androidx/annotation/NonNull T> diffCallback` | The `https://developer.android.com/reference/androidx/recyclerview/widget/DiffUtil.ItemCallback` instance to compare items in the list. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html mainDispatcher` | The `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html` to be used for foreground operations |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html workerDispatcher` | The `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-dispatcher/index.html` to be used for computing diff |

## Public methods

### addLoadStateListener

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

```
public final void addLoadStateListener(
    @NonNull Function1<@NonNull CombinedLoadStates, Unit> listener
)
```

Add a `https://developer.android.com/reference/androidx/paging/CombinedLoadStates` listener to observe the loading state of the current `https://developer.android.com/reference/androidx/paging/PagingData`.

As new `https://developer.android.com/reference/androidx/paging/PagingData` generations are submitted and displayed, the listener will be notified to reflect the current `https://developer.android.com/reference/androidx/paging/CombinedLoadStates`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/CombinedLoadStates, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> listener` | `https://developer.android.com/reference/androidx/paging/CombinedLoadStates` listener to receive updates. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/leanback/paging/PagingDataAdapter#removeLoadStateListener(kotlin.Function1)` |   |

### get

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

```
public T get(int position)
```

Returns the item for the given position. It will return null if placeholders are enabled and data is not yet loaded.

### getLoadStateFlow

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

```
public final @NonNull Flow<@NonNull CombinedLoadStates> getLoadStateFlow()
```

A hot `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html` of `https://developer.android.com/reference/androidx/paging/CombinedLoadStates` that emits a snapshot whenever the loading state of the current `https://developer.android.com/reference/androidx/paging/PagingData` changes.

This flow is conflated, so it buffers the last update to `https://developer.android.com/reference/androidx/paging/CombinedLoadStates` and immediately delivers the current load states on collection.

### peek

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

```
public final T peek(@IntRange(from = 0) int index)
```

Returns the presented item at the specified position, without notifying Paging of the item access that would normally trigger page loads.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int index` | Index of the presented item to return, including placeholders. |

| Returns |
|---|---|
| `T` | The presented item at position `https://developer.android.com/reference/androidx/leanback/paging/PagingDataAdapter#peek(kotlin.Int)`, `null` if it is a placeholder. |

### refresh

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

```
public final void refresh()
```

Refresh the data presented by this `https://developer.android.com/reference/androidx/leanback/paging/PagingDataAdapter`.

`https://developer.android.com/reference/androidx/leanback/paging/PagingDataAdapter#refresh()` triggers the creation of a new `https://developer.android.com/reference/androidx/paging/PagingData` with a new instance of `https://developer.android.com/reference/androidx/paging/PagingSource` to represent an updated snapshot of the backing dataset. If a `https://developer.android.com/reference/androidx/paging/RemoteMediator` is set, calling `https://developer.android.com/reference/androidx/leanback/paging/PagingDataAdapter#refresh()` will also trigger a call to `https://developer.android.com/reference/androidx/paging/RemoteMediator#load(androidx.paging.LoadType,androidx.paging.PagingState)` with `https://developer.android.com/reference/androidx/paging/LoadType` REFRESH\] to allow `https://developer.android.com/reference/androidx/paging/RemoteMediator` to check for updates to the dataset backing `https://developer.android.com/reference/androidx/paging/PagingSource`.

Note: This API is intended for UI-driven refresh signals, such as swipe-to-refresh. Invalidation due repository-layer signals, such as DB-updates, should instead use `https://developer.android.com/reference/androidx/paging/PagingSource#invalidate()`.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/paging/PagingSource#invalidate()` |   |

### removeLoadStateListener

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

```
public final void removeLoadStateListener(
    @NonNull Function1<@NonNull CombinedLoadStates, Unit> listener
)
```

Remove a previously registered `https://developer.android.com/reference/androidx/paging/CombinedLoadStates` listener.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull Function1<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/paging/CombinedLoadStates, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html> listener` | Previously registered listener. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/leanback/paging/PagingDataAdapter#addLoadStateListener(kotlin.Function1)` |   |

### retry

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

```
public final void retry()
```

Retry any failed load requests that would result in a `https://developer.android.com/reference/androidx/paging/LoadState.Error` update to this

`https://developer.android.com/reference/androidx/leanback/paging/PagingDataAdapter`.

`https://developer.android.com/reference/androidx/paging/LoadState.Error` can be generated from two types of load requests: `https://developer.android.com/reference/androidx/paging/PagingSource#load(androidx.paging.PagingSource.LoadParams)` returning `https://developer.android.com/reference/androidx/paging/RemoteMediator#load(androidx.paging.LoadType,androidx.paging.PagingState)` returning `https://developer.android.com/reference/androidx/paging/RemoteMediator.MediatorResult.Error`

### size

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

```
public int size()
```

| Returns |
|---|---|
| `int` | Total number of presented items, including placeholders. |

### snapshot

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

```
public final @NonNull ItemSnapshotList<@NonNull T> snapshot()
```

Returns a new `https://developer.android.com/reference/androidx/paging/ItemSnapshotList` representing the currently presented items, including any placeholders if they are enabled.

### submitData

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

```
public final void submitData(@NonNull PagingData<@NonNull T> pagingData)
```

Present a `https://developer.android.com/reference/androidx/paging/PagingData` until it is invalidated by a call to `https://developer.android.com/reference/androidx/leanback/paging/PagingDataAdapter#refresh()` or `https://developer.android.com/reference/androidx/paging/PagingSource#invalidate()`.

This method is typically used when collecting from a `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html` produced by `https://developer.android.com/reference/androidx/paging/Pager`. For RxJava or LiveData support, use the non-suspending overload of `https://developer.android.com/reference/androidx/leanback/paging/PagingDataAdapter#submitData(androidx.paging.PagingData)`, which accepts a `https://developer.android.com/reference/androidx/lifecycle/Lifecycle`.

Note: This method suspends while it is actively presenting page loads from a `https://developer.android.com/reference/androidx/paging/PagingData`, until the `https://developer.android.com/reference/androidx/paging/PagingData` is invalidated. Although cancellation will propagate to this call automatically, collecting from a `https://developer.android.com/reference/androidx/paging/Pager#flow()` with the intention of presenting the most up-to-date representation of your backing dataset should typically be done using `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/index.html`.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/paging/Pager` |   |

### submitData

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/leanback#1.1.0)

```
public final void submitData(
    @NonNull Lifecycle lifecycle,
    @NonNull PagingData<@NonNull T> pagingData
)
```

Present a `https://developer.android.com/reference/androidx/paging/PagingData` until it is either invalidated or another call to `https://developer.android.com/reference/androidx/leanback/paging/PagingDataAdapter#submitData(androidx.lifecycle.Lifecycle,androidx.paging.PagingData)` is made.

This method is typically used when observing a RxJava or LiveData stream produced by `https://developer.android.com/reference/androidx/paging/Pager`. For `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines.flow/-flow/index.html` support, use the suspending overload of `https://developer.android.com/reference/androidx/leanback/paging/PagingDataAdapter#submitData(androidx.lifecycle.Lifecycle,androidx.paging.PagingData)`, which automates cancellation via `https://kotlinlang.org/api/kotlinx.coroutines/kotlinx-coroutines-core/kotlinx.coroutines/-coroutine-scope/index.html` instead of relying of `https://developer.android.com/reference/androidx/lifecycle/Lifecycle`.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/leanback/paging/PagingDataAdapter#submitData(androidx.lifecycle.Lifecycle,androidx.paging.PagingData)` |   |
| `https://developer.android.com/reference/androidx/paging/Pager` |   |