# PagedListAdapter

Artifact: [androidx.paging:paging-runtime](https://developer.android.com/jetpack/androidx/releases/paging) [View Source](https://cs.android.com/search?q=file:androidx/paging/PagedListAdapter.kt+class:androidx.paging.PagedListAdapter) Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/paging#2.0.0) Deprecated in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0)

*** ** * ** ***

Common/AllAndroid/JVMNative/C/iOSJavaScript
- android

  ```
  abstract class PagedListAdapter<T : Any, VH : RecyclerView.ViewHolder> : RecyclerView.Adapter<VH>
  ```

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||
| ↳ | [androidx.recyclerview.widget.RecyclerView.Adapter](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter)\<VH\> ||
|   | ↳ | [androidx.paging.PagedListAdapter](https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter) |

*** ** * ** ***

> [!CAUTION]
> **This class is deprecated.**   
> PagedListAdapter is deprecated and has been replaced by PagingDataAdapter, use this instead:
>
> ```kotlin
> PagingDataAdapter<T, VH>
> ```

`https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter` base class for presenting paged data from `https://developer.android.com/reference/kotlin/androidx/paging/PagedList`s in a `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView`.

This class is a convenience wrapper around `https://developer.android.com/reference/kotlin/androidx/paging/AsyncPagedListDiffer` that implements common default behavior for item counting, and listening to PagedList update callbacks.

While using a LiveData is an easy way to provide data to the adapter, it isn't required - you can use `https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter#submitList(androidx.paging.PagedList)` when new lists are available.

PagedListAdapter listens to PagedList loading callbacks as pages are loaded, and uses DiffUtil on a background thread to compute fine grained updates as new PagedLists are received.

Handles both the internal paging of the list as more data is loaded, and updates in the form of new PagedLists.

A complete usage pattern with Room would look like this:

```kotlin
@Dao
interface UserDao {
    @Query("SELECT * FROM user ORDER BY lastName ASC")
    public abstract DataSource.Factory<Integer, User> usersByLastName();
}

class MyViewModel extends ViewModel {
    public final LiveData<PagedList<User>> usersList;
    public MyViewModel(UserDao userDao) {
        usersList = new LivePagedListBuilder&lt;>(
        userDao.usersByLastName(), /* page size */20).build();
    }
}

class MyActivity extends AppCompatActivity {
    @Override
    public void onCreate(Bundle savedState) {
        super.onCreate(savedState);
        MyViewModel viewModel = new ViewModelProvider(this).get(MyViewModel.class);
        RecyclerView recyclerView = findViewById(R.id.user_list);
        UserAdapter&lt;User> adapter = new UserAdapter();
        viewModel.usersList.observe(this, pagedList -> adapter.submitList(pagedList));
        recyclerView.setAdapter(adapter);
    }
}

class UserAdapter extends PagedListAdapter<User, UserViewHolder> {
    public UserAdapter() {
        super(DIFF_CALLBACK);
    }
    @Override
    public void onBindViewHolder(UserViewHolder holder, int position) {
        User user = getItem(position);
        if (user != null) {
            holder.bindTo(user);
        } else {
            // Null defines a placeholder item - PagedListAdapter will automatically invalidate
            // this row when the actual object is loaded from the database
            holder.clear();
        }
    }
    public static final DiffUtil.ItemCallback&lt;User> DIFF_CALLBACK =
            new DiffUtil.ItemCallback<User>() {
        @Override
        public boolean areItemsTheSame(@NonNull User oldUser, @NonNull User newUser) {
            // User properties may have changed if reloaded from the DB, but ID is fixed
            return oldUser.getId() == newUser.getId();
        }
        @Override
        public boolean areContentsTheSame(@NonNull User oldUser, @NonNull User newUser) {
            // NOTE: if you use equals, your object must properly override Object#equals()
            // Incorrectly returning false here will result in too many animations.
            return oldUser.equals(newUser);
        }
    }
}
```

Advanced users that wish for more control over adapter behavior, or to provide a specific base class should refer to `https://developer.android.com/reference/kotlin/androidx/paging/AsyncPagedListDiffer`, which provides the mapping from paging events to adapter-friendly callbacks.

| Parameters |
|---|---|
| `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html>` | Type of the PagedLists this Adapter will receive. |
| `<VH : https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder>` | A class that extends ViewHolder that will be used by the adapter. |

## Summary

| ### Protected constructors |
|---|---|
| `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html, VH : https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder> [PagedListAdapter](https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter#PagedListAdapter(androidx.recyclerview.widget.AsyncDifferConfig))( config: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/AsyncDifferConfig<T> )` **This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter | android |
| `<T : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html, VH : https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder> [PagedListAdapter](https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter#PagedListAdapter(androidx.recyclerview.widget.DiffUtil.ItemCallback))( diffCallback: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/DiffUtil.ItemCallback<T> )` **This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter | android |

| ### Public functions |
|---|---|---|
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[addLoadStateListener](https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter#addLoadStateListener(kotlin.Function2))(listener: (https://developer.android.com/reference/kotlin/androidx/paging/LoadType, https://developer.android.com/reference/kotlin/androidx/paging/LoadState) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)` **This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter | android |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `[getItemCount](https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter#getItemCount())()` **This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter | android |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[onCurrentListChanged](https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter#onCurrentListChanged(androidx.paging.PagedList))(currentList: https://developer.android.com/reference/kotlin/androidx/paging/PagedList<T>?)` **This function is deprecated.** Use the two argument variant instead. | android |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[onCurrentListChanged](https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter#onCurrentListChanged(androidx.paging.PagedList,androidx.paging.PagedList))( previousList: https://developer.android.com/reference/kotlin/androidx/paging/PagedList<T>?, currentList: https://developer.android.com/reference/kotlin/androidx/paging/PagedList<T>? )` **This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter | android |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[removeLoadStateListener](https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter#removeLoadStateListener(kotlin.Function2))(listener: (https://developer.android.com/reference/kotlin/androidx/paging/LoadType, https://developer.android.com/reference/kotlin/androidx/paging/LoadState) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)` **This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter | android |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[submitList](https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter#submitList(androidx.paging.PagedList))(pagedList: https://developer.android.com/reference/kotlin/androidx/paging/PagedList<T>?)` **This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter | android |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `[submitList](https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter#submitList(androidx.paging.PagedList,java.lang.Runnable))(pagedList: https://developer.android.com/reference/kotlin/androidx/paging/PagedList<T>?, commitCallback: https://developer.android.com/reference/java/lang/Runnable.html?)` **This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter | android |
| `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter` | `[withLoadStateFooter](https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter#withLoadStateFooter(androidx.paging.LoadStateAdapter))(footer: https://developer.android.com/reference/kotlin/androidx/paging/LoadStateAdapter<*>)` **This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter | android |
| `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter` | `[withLoadStateHeader](https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter#withLoadStateHeader(androidx.paging.LoadStateAdapter))(header: https://developer.android.com/reference/kotlin/androidx/paging/LoadStateAdapter<*>)` **This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter | android |
| `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter` | `[withLoadStateHeaderAndFooter](https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter#withLoadStateHeaderAndFooter(androidx.paging.LoadStateAdapter,androidx.paging.LoadStateAdapter))( header: https://developer.android.com/reference/kotlin/androidx/paging/LoadStateAdapter<*>, footer: https://developer.android.com/reference/kotlin/androidx/paging/LoadStateAdapter<*> )` **This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter | android |

| ### Protected functions |
|---|---|---|
| `open T?` | `[getItem](https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter#getItem(kotlin.Int))(position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` **This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter | android |

| ### Public properties |
|---|---|---|
| `open https://developer.android.com/reference/kotlin/androidx/paging/PagedList<T>?` | `https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter#currentList()` **This property is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter | android |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter#itemCount()` **This property is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter | android |

### Inherited functions

From [androidx.recyclerview.widget.RecyclerView.Adapter](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[bindViewHolder](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#bindViewHolder(VH,int))(holder: VH, position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

**This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter
android `VH` `[createViewHolder](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#createViewHolder(android.view.ViewGroup,int))(parent: https://developer.android.com/reference/android/view/ViewGroup.html, viewType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

**This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter
android `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `[findRelativeAdapterPositionIn](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#findRelativeAdapterPositionIn(androidx.recyclerview.widget.RecyclerView.Adapter<? extends androidx.recyclerview.widget.RecyclerView.ViewHolder>,androidx.recyclerview.widget.RecyclerView.ViewHolder,int))(
adapter: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter<https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder>,
viewHolder: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder,
localPosition: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html
)`

**This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter
android `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` `[getItemId](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#getItemId(int))(position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

**This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter
android `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `[getItemViewType](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#getItemViewType(int))(position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

**This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter
android `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `[hasObservers](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#hasObservers())()`

**This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter
android `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `[hasStableIds](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#hasStableIds())()`

**This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter
android `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[notifyDataSetChanged](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#notifyDataSetChanged())()`

**This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter
android `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[notifyItemChanged](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#notifyItemChanged(int))(position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

**This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter
android `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[notifyItemChanged](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#notifyItemChanged(int,java.lang.Object))(position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, payload: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)`

**This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter
android `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[notifyItemInserted](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#notifyItemInserted(int))(position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

**This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter
android `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[notifyItemMoved](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#notifyItemMoved(int,int))(fromPosition: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, toPosition: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

**This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter
android `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[notifyItemRangeChanged](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#notifyItemRangeChanged(int,int))(positionStart: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, itemCount: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

**This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter
android `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[notifyItemRangeChanged](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#notifyItemRangeChanged(int,int,java.lang.Object))(positionStart: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, itemCount: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, payload: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)`

**This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter
android `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[notifyItemRangeInserted](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#notifyItemRangeInserted(int,int))(positionStart: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, itemCount: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

**This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter
android `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[notifyItemRangeRemoved](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#notifyItemRangeRemoved(int,int))(positionStart: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, itemCount: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

**This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter
android `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[notifyItemRemoved](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#notifyItemRemoved(int))(position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

**This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter
android `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[onAttachedToRecyclerView](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#onAttachedToRecyclerView(androidx.recyclerview.widget.RecyclerView))(recyclerView: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView)`

**This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter
android `abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[onBindViewHolder](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#onBindViewHolder(VH,int))(holder: VH, position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

**This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter
android `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[onBindViewHolder](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#onBindViewHolder(VH,int,java.util.List<java.lang.Object>))(holder: VH, position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, payloads: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html>)`

**This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter
android `abstract VH` `[onCreateViewHolder](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#onCreateViewHolder(android.view.ViewGroup,int))(parent: https://developer.android.com/reference/android/view/ViewGroup.html, viewType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

**This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter
android `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[onDetachedFromRecyclerView](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#onDetachedFromRecyclerView(androidx.recyclerview.widget.RecyclerView))(recyclerView: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView)`

**This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter
android `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `[onFailedToRecycleView](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#onFailedToRecycleView(VH))(holder: VH)`

**This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter
android `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[onViewAttachedToWindow](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#onViewAttachedToWindow(VH))(holder: VH)`

**This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter
android `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[onViewDetachedFromWindow](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#onViewDetachedFromWindow(VH))(holder: VH)`

**This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter
android `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[onViewRecycled](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#onViewRecycled(VH))(holder: VH)`

**This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter
android `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[registerAdapterDataObserver](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#registerAdapterDataObserver(androidx.recyclerview.widget.RecyclerView.AdapterDataObserver))(observer: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.AdapterDataObserver)`

**This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter
android `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[setHasStableIds](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#setHasStableIds(boolean))(hasStableIds: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

**This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter
android `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[unregisterAdapterDataObserver](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#unregisterAdapterDataObserver(androidx.recyclerview.widget.RecyclerView.AdapterDataObserver))(
observer: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.AdapterDataObserver
)`

**This function is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter
android

### Inherited properties

From [androidx.recyclerview.widget.RecyclerView.Adapter](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter) `final https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter.StateRestorationPolicy` `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#stateRestorationPolicy()`

**This property is deprecated.** PagedListAdapter is deprecated and has been replaced by PagingDataAdapter
android

## Protected constructors

### PagedListAdapter

android

```
protected <T : Any, VH : RecyclerView.ViewHolder> [PagedListAdapter](https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter#PagedListAdapter(androidx.recyclerview.widget.AsyncDifferConfig))(
    config: AsyncDifferConfig<T>
)
```

> [!CAUTION]
> **This function is deprecated.**   
> PagedListAdapter is deprecated and has been replaced by PagingDataAdapter, use this instead:
>
> ```kotlin
> PagingDataAdapter<T, VH>
> ```

### PagedListAdapter

android

```
protected <T : Any, VH : RecyclerView.ViewHolder> [PagedListAdapter](https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter#PagedListAdapter(androidx.recyclerview.widget.DiffUtil.ItemCallback))(
    diffCallback: DiffUtil.ItemCallback<T>
)
```

> [!CAUTION]
> **This function is deprecated.**   
> PagedListAdapter is deprecated and has been replaced by PagingDataAdapter, use this instead:
>
> ```kotlin
> PagingDataAdapter<T, VH>
> ```

Creates a `https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter` with default threading and `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ListUpdateCallback`.

Convenience for `https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter`, which uses default threading behavior.

| Parameters |
|---|---|
| `diffCallback: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/DiffUtil.ItemCallback<T>` | The `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/DiffUtil.ItemCallback` instance to compare items in the list. |

## Public functions

### addLoadStateListener

android Added in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0) Deprecated in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0)

```
open fun [addLoadStateListener](https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter#addLoadStateListener(kotlin.Function2))(listener: (LoadType, LoadState) -> Unit): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
> PagedListAdapter is deprecated and has been replaced by PagingDataAdapter, use this instead:
>
> ```kotlin
> PagingDataAdapter<T, VH>
> ```

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

As new PagedLists are submitted and displayed, the listener will be notified to reflect current `https://developer.android.com/reference/kotlin/androidx/paging/LoadType#REFRESH`, `https://developer.android.com/reference/kotlin/androidx/paging/LoadType#PREPEND`, and `https://developer.android.com/reference/kotlin/androidx/paging/LoadType#APPEND` states.

| Parameters |
|---|---|
| `listener: (https://developer.android.com/reference/kotlin/androidx/paging/LoadType, https://developer.android.com/reference/kotlin/androidx/paging/LoadState) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | Listener to receive `https://developer.android.com/reference/kotlin/androidx/paging/LoadState` updates. |

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

### getItemCount

android Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/paging#2.0.0) Deprecated in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0)

```
open fun [getItemCount](https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter#getItemCount())(): Int
```

> [!CAUTION]
> **This function is deprecated.**   
> PagedListAdapter is deprecated and has been replaced by PagingDataAdapter, use this instead:
>
> ```kotlin
> PagingDataAdapter<T, VH>
> ```

Returns the total number of items in the data set held by the adapter.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The total number of items in this adapter. |

### onCurrentListChanged

android Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/paging#2.0.0) Deprecated in [2.1.0](https://developer.android.com/jetpack/androidx/releases/paging#2.1.0)

```
open fun [onCurrentListChanged](https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter#onCurrentListChanged(androidx.paging.PagedList))(currentList: PagedList<T>?): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
> Use the two argument variant instead, use this instead:
>
> ```kotlin
> onCurrentListChanged(previousList, currentList)
> ```

Called when the current PagedList is updated.

This may be dispatched as part of `https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter#submitList(androidx.paging.PagedList)` if a background diff isn't needed (such as when the first list is passed, or the list is cleared). In either case, PagedListAdapter will simply call `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#notifyItemRangeInserted(int,int)`.

This method will *not*be called when the Adapter switches from presenting a PagedList to a snapshot version of the PagedList during a diff. This means you cannot observe each PagedList via this method.

| Parameters |
|---|---|
| `currentList: https://developer.android.com/reference/kotlin/androidx/paging/PagedList<T>?` | new PagedList being displayed, may be null. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter#onCurrentListChanged(androidx.paging.PagedList)` |   |

### onCurrentListChanged

android Added in [2.1.0](https://developer.android.com/jetpack/androidx/releases/paging#2.1.0) Deprecated in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0)

```
open fun [onCurrentListChanged](https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter#onCurrentListChanged(androidx.paging.PagedList,androidx.paging.PagedList))(
    previousList: PagedList<T>?,
    currentList: PagedList<T>?
): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
> PagedListAdapter is deprecated and has been replaced by PagingDataAdapter, use this instead:
>
> ```kotlin
> PagingDataAdapter<T, VH>
> ```

Called when the current PagedList is updated.

This may be dispatched as part of `https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter#submitList(androidx.paging.PagedList)` if a background diff isn't needed (such as when the first list is passed, or the list is cleared). In either case, PagedListAdapter will simply call `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#notifyItemRangeInserted(int,int)`.

This method will *not*be called when the Adapter switches from presenting a PagedList to a snapshot version of the PagedList during a diff. This means you cannot observe each PagedList via this method.

| Parameters |
|---|---|
| `previousList: https://developer.android.com/reference/kotlin/androidx/paging/PagedList<T>?` | `https://developer.android.com/reference/kotlin/androidx/paging/PagedList` that was previously displayed, may be null. |
| `currentList: https://developer.android.com/reference/kotlin/androidx/paging/PagedList<T>?` | new `https://developer.android.com/reference/kotlin/androidx/paging/PagedList` being displayed, may be null. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter#onCurrentListChanged(androidx.paging.PagedList,androidx.paging.PagedList)` |   |

### removeLoadStateListener

android Added in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0) Deprecated in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0)

```
open fun [removeLoadStateListener](https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter#removeLoadStateListener(kotlin.Function2))(listener: (LoadType, LoadState) -> Unit): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
> PagedListAdapter is deprecated and has been replaced by PagingDataAdapter, use this instead:
>
> ```kotlin
> PagingDataAdapter<T, VH>
> ```

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

| Parameters |
|---|---|
| `listener: (https://developer.android.com/reference/kotlin/androidx/paging/LoadType, https://developer.android.com/reference/kotlin/androidx/paging/LoadState) -> https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | Previously registered listener. |

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

### submitList

android Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/paging#2.0.0) Deprecated in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0)

```
open fun [submitList](https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter#submitList(androidx.paging.PagedList))(pagedList: PagedList<T>?): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
> PagedListAdapter is deprecated and has been replaced by PagingDataAdapter, use this instead:
>
> ```kotlin
> PagingDataAdapter<T, VH>
> ```

Set the new list to be displayed.

If a list is already being displayed, a diff will be computed on a background thread, which will dispatch Adapter.notifyItem events on the main thread.

| Parameters |
|---|---|
| `pagedList: https://developer.android.com/reference/kotlin/androidx/paging/PagedList<T>?` | The new list to be displayed. |

### submitList

android Added in [2.1.0](https://developer.android.com/jetpack/androidx/releases/paging#2.1.0) Deprecated in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0)

```
open fun [submitList](https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter#submitList(androidx.paging.PagedList,java.lang.Runnable))(pagedList: PagedList<T>?, commitCallback: Runnable?): Unit
```

> [!CAUTION]
> **This function is deprecated.**   
> PagedListAdapter is deprecated and has been replaced by PagingDataAdapter, use this instead:
>
> ```kotlin
> PagingDataAdapter<T, VH>
> ```

Set the new list to be displayed.

If a list is already being displayed, a diff will be computed on a background thread, which will dispatch Adapter.notifyItem events on the main thread.

The commit callback can be used to know when the PagedList is committed, but note that it may not be executed. If PagedList B is submitted immediately after PagedList A, and is committed directly, the callback associated with PagedList A will not be run.

| Parameters |
|---|---|
| `pagedList: https://developer.android.com/reference/kotlin/androidx/paging/PagedList<T>?` | The new list to be displayed. |
| `commitCallback: https://developer.android.com/reference/java/lang/Runnable.html?` | Optional runnable that is executed when the PagedList is committed, if it is committed. |

### withLoadStateFooter

android Added in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0) Deprecated in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0)

```
fun [withLoadStateFooter](https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter#withLoadStateFooter(androidx.paging.LoadStateAdapter))(footer: LoadStateAdapter<*>): ConcatAdapter
```

> [!CAUTION]
> **This function is deprecated.**   
> PagedListAdapter is deprecated and has been replaced by PagingDataAdapter, use this instead:
>
> ```kotlin
> PagingDataAdapter<T, VH>
> ```

Create a `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter` with the provided `https://developer.android.com/reference/kotlin/androidx/paging/LoadStateAdapter`s displaying the `https://developer.android.com/reference/kotlin/androidx/paging/LoadState` as a list item at the start of the presented list.

### withLoadStateHeader

android Added in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0) Deprecated in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0)

```
fun [withLoadStateHeader](https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter#withLoadStateHeader(androidx.paging.LoadStateAdapter))(header: LoadStateAdapter<*>): ConcatAdapter
```

> [!CAUTION]
> **This function is deprecated.**   
> PagedListAdapter is deprecated and has been replaced by PagingDataAdapter, use this instead:
>
> ```kotlin
> PagingDataAdapter<T, VH>
> ```

Create a `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter` with the provided `https://developer.android.com/reference/kotlin/androidx/paging/LoadStateAdapter`s displaying the `https://developer.android.com/reference/kotlin/androidx/paging/LoadState` as a list item at the end of the presented list.

### withLoadStateHeaderAndFooter

android Added in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0) Deprecated in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0)

```
fun [withLoadStateHeaderAndFooter](https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter#withLoadStateHeaderAndFooter(androidx.paging.LoadStateAdapter,androidx.paging.LoadStateAdapter))(
    header: LoadStateAdapter<*>,
    footer: LoadStateAdapter<*>
): ConcatAdapter
```

> [!CAUTION]
> **This function is deprecated.**   
> PagedListAdapter is deprecated and has been replaced by PagingDataAdapter, use this instead:
>
> ```kotlin
> PagingDataAdapter<T, VH>
> ```

Create a `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter` with the provided `https://developer.android.com/reference/kotlin/androidx/paging/LoadStateAdapter`s displaying the `https://developer.android.com/reference/kotlin/androidx/paging/LoadType#PREPEND` and `https://developer.android.com/reference/kotlin/androidx/paging/LoadState`s as list items at the start and end respectively.

## Protected functions

### getItem

android Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/paging#2.0.0) Deprecated in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0)

```
protected open fun [getItem](https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter#getItem(kotlin.Int))(position: Int): T?
```

> [!CAUTION]
> **This function is deprecated.**   
> PagedListAdapter is deprecated and has been replaced by PagingDataAdapter, use this instead:
>
> ```kotlin
> PagingDataAdapter<T, VH>
> ```

## Public properties

### currentList

android Added in [2.0.0](https://developer.android.com/jetpack/androidx/releases/paging#2.0.0) Deprecated in [3.0.0](https://developer.android.com/jetpack/androidx/releases/paging#3.0.0)

```
open val currentList: PagedList<T>?
```

> [!CAUTION]
> **This property is deprecated.**   
> PagedListAdapter is deprecated and has been replaced by PagingDataAdapter, use this instead:
>
> ```kotlin
> PagingDataAdapter<T, VH>
> ```

Returns the `https://developer.android.com/reference/kotlin/androidx/paging/PagedList` currently being displayed by the `https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter`.

This is not necessarily the most recent list passed to `https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter#submitList(androidx.paging.PagedList)`, because a diff is computed asynchronously between the new list and the current list before updating the currentList value. May be null if no PagedList is being presented.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/paging/PagedList<T>?` | The list currently being displayed. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/paging/PagedListAdapter#onCurrentListChanged(androidx.paging.PagedList)` |   |

### itemCount

android Added in 2.0.0 Deprecated in 3.0.0

```
open val itemCount: Int
```

> [!CAUTION]
> **This property is deprecated.**   
> PagedListAdapter is deprecated and has been replaced by PagingDataAdapter, use this instead:
>
> ```kotlin
> PagingDataAdapter<T, VH>
> ```