# ConcatAdapter

Artifact: [androidx.recyclerview:recyclerview](https://developer.android.com/jetpack/androidx/releases/recyclerview) [View Source](https://cs.android.com/search?q=file:androidx/recyclerview/widget/ConcatAdapter.java+class:androidx.recyclerview.widget.ConcatAdapter) Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/recyclerview#1.2.0)

*** ** * ** ***


```
class ConcatAdapter : RecyclerView.Adapter<RecyclerView.ViewHolder!>
```

<br />

|---|---|---|
| [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)\<[RecyclerView.ViewHolder](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder)!\> ||
|   | ↳ | [androidx.recyclerview.widget.ConcatAdapter](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter) |

*** ** * ** ***

An `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter` implementation that presents the contents of multiple adapters in sequence.

```kotlin
MyAdapter adapter1 = ...;
AnotherAdapter adapter2 = ...;
ConcatAdapter concatenated = new ConcatAdapter(adapter1, adapter2);
recyclerView.setAdapter(concatenated);
```

By default, `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter` isolates view types of nested adapters from each other such that it will change the view type before reporting it back to the `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView` to avoid any conflicts between the view types of added adapters. This also means each added adapter will have its own isolated pool of `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder`s, with no re-use in between added adapters.

If your `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter`s share the same view types, and can support sharing `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder` s between added adapters, provide an instance of `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter.Config` where you set `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter.Config#isolateViewTypes()` to `false`. A common usage pattern for this is to return the `R.layout.<layout_name>` from the `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#getItemViewType(int)` method.

When an added adapter calls one of the `notify` methods, `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter` properly offsets values before reporting it back to the `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView`. If an adapter calls `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#notifyDataSetChanged()`, `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter` also calls `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#notifyDataSetChanged()` as calling `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#notifyItemRangeChanged(int,int)` will confuse the `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView`. You are highly encouraged to to use `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/SortedList` or `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ListAdapter` to avoid calling `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#notifyDataSetChanged()`.

Whether `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter` should support stable ids is defined in the `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter.Config` object. Calling `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#setHasStableIds(boolean)` has no effect. See documentation for `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter.Config.StableIdMode` for details on how to configure `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter` to use stable ids. By default, it will not use stable ids and sub adapter stable ids will be ignored. Similar to the case above, you are highly encouraged to use `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ListAdapter`, which will automatically calculate the changes in the data set for you so you won't need stable ids.

It is common to find the adapter position of a `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder` to handle user action on the `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder`. For those cases, instead of calling `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder#getAdapterPosition()`, use `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder#getBindingAdapterPosition()`. If your adapters share `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder`s, you can use the `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder#getBindingAdapter()` method to find the adapter which last bound that `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder`.

## Summary

| ### Nested types |
|---|
| `class https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter.Config` The configuration object for a `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter`. |
| `class https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter.Config.Builder` The builder for `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter.Config` class. |
| `enum https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter.Config.StableIdMode` Defines how `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter` handle stable ids (`https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#hasStableIds()`). |

| ### Public constructors |
|---|
| `@https://developer.android.com/reference/java/lang/SafeVarargs.html https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter#ConcatAdapter(androidx.recyclerview.widget.RecyclerView.Adapter<? extends androidx.recyclerview.widget.RecyclerView.ViewHolder>...)( adapters: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter<https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder!>!> )` Creates a ConcatAdapter with `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter.Config#DEFAULT()` and the given adapters in the given order. |
| `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter#ConcatAdapter(java.util.List<? extends androidx.recyclerview.widget.RecyclerView.Adapter<? extends androidx.recyclerview.widget.RecyclerView.ViewHolder>>)( adapters: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter<https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder!>!> )` Creates a ConcatAdapter with `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter.Config#DEFAULT()` and the given adapters in the given order. |
| `@https://developer.android.com/reference/java/lang/SafeVarargs.html https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter#ConcatAdapter(androidx.recyclerview.widget.ConcatAdapter.Config,androidx.recyclerview.widget.RecyclerView.Adapter<? extends androidx.recyclerview.widget.RecyclerView.ViewHolder>...)( config: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter.Config, adapters: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter<https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder!>!> )` Creates a ConcatAdapter with the given config and the given adapters in the given order. |
| `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter#ConcatAdapter(androidx.recyclerview.widget.ConcatAdapter.Config,java.util.List<? extends androidx.recyclerview.widget.RecyclerView.Adapter<? extends androidx.recyclerview.widget.RecyclerView.ViewHolder>>)( config: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter.Config, adapters: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter<https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder!>!> )` Creates a ConcatAdapter with the given config and the given adapters in the given order. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter#addAdapter(androidx.recyclerview.widget.RecyclerView.Adapter<? extends androidx.recyclerview.widget.RecyclerView.ViewHolder>)(adapter: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter<https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder!>)` Appends the given adapter to the existing list of adapters and notifies the observers of this `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter#addAdapter(int,androidx.recyclerview.widget.RecyclerView.Adapter<? extends androidx.recyclerview.widget.RecyclerView.ViewHolder>)( index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, adapter: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter<https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder!> )` Adds the given adapter to the given index among other adapters that are already added. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter#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 )` Returns the position of the given `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder` in the given `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter`. |
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter<https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder!>!>` | `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter#getAdapters()()` Returns an unmodifiable copy of the list of adapters in this `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter#getItemCount()()` Returns the total number of items in the data set held by the adapter. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter#getItemId(int)(position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Return the stable ID for the item at `position`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter#getItemViewType(int)(position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Return the view type of the item at `position` for the purposes of view recycling. |
| `https://developer.android.com/reference/android/util/Pair.html<https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter<https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder!>!, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html!>` | `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter#getWrappedAdapterAndPosition(int)(globalPosition: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Retrieve the adapter and local position for a given position in this `ConcatAdapter`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter#onAttachedToRecyclerView(androidx.recyclerview.widget.RecyclerView)(recyclerView: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView)` Called by RecyclerView when it starts observing this Adapter. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter#onBindViewHolder(androidx.recyclerview.widget.RecyclerView.ViewHolder,int)(holder: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder, position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Called by RecyclerView to display the data at the specified position. |
| `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder` | `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter#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)` Called when RecyclerView needs a new `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder` of the given type to represent an item. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter#onDetachedFromRecyclerView(androidx.recyclerview.widget.RecyclerView)(recyclerView: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView)` Called by RecyclerView when it stops observing this Adapter. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter#onFailedToRecycleView(androidx.recyclerview.widget.RecyclerView.ViewHolder)(holder: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder)` Called by the RecyclerView if a ViewHolder created by this Adapter cannot be recycled due to its transient state. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter#onViewAttachedToWindow(androidx.recyclerview.widget.RecyclerView.ViewHolder)(holder: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder)` Called when a view created by this adapter has been attached to a window. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter#onViewDetachedFromWindow(androidx.recyclerview.widget.RecyclerView.ViewHolder)(holder: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder)` Called when a view created by this adapter has been detached from its window. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter#onViewRecycled(androidx.recyclerview.widget.RecyclerView.ViewHolder)(holder: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder)` Called when a view created by this adapter has been recycled. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter#removeAdapter(androidx.recyclerview.widget.RecyclerView.Adapter<? extends androidx.recyclerview.widget.RecyclerView.ViewHolder>)(adapter: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter<https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder!>)` Removes the given adapter from the adapters list if it exists |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter#setHasStableIds(boolean)(hasStableIds: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Calling this method is an error and will result in an `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html`. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter#setStateRestorationPolicy(androidx.recyclerview.widget.RecyclerView.Adapter.StateRestorationPolicy)( strategy: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter.StateRestorationPolicy )` Calling this method is an error and will result in an `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html`. |

### 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` `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 method internally calls `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#onBindViewHolder(VH,int)` to update the `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder` contents with the item at the given position and also sets up some private fields to be used by RecyclerView.
`VH` `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 method calls `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#onCreateViewHolder(android.view.ViewGroup,int)` to create a new `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder` and initializes some private fields to be used by RecyclerView.
`https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter.StateRestorationPolicy` `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#getStateRestorationPolicy()()`

Returns when this Adapter wants to restore the state.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#hasObservers()()`

Returns true if one or more observers are attached to this adapter.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#hasStableIds()()`

Returns true if this adapter publishes a unique `long` value that can act as a key for the item at a given position in the data set.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#notifyDataSetChanged()()`

Notify any registered observers that the data set has changed.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `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)`

Notify any registered observers that the item at `position` has changed.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `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?)`

Notify any registered observers that the item at `position` has changed with an optional payload object.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `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)`

Notify any registered observers that the item reflected at `position` has been newly inserted.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `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)`

Notify any registered observers that the item reflected at `fromPosition` has been moved to `toPosition`.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `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)`

Notify any registered observers that the `itemCount` items starting at position `positionStart` have changed.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `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?)`

Notify any registered observers that the `itemCount` items starting at position `positionStart` have changed.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `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)`

Notify any registered observers that the currently reflected `itemCount` items starting at `positionStart` have been newly inserted.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `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)`

Notify any registered observers that the `itemCount` items previously located at `positionStart` have been removed from the data set.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `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)`

Notify any registered observers that the item previously located at `position` has been removed from the data set.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `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.collections/-list/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!>)`

Called by RecyclerView to display the data at the specified position.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `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)`

Register a new observer to listen for data changes.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `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
)`

Unregister an observer currently listening for data changes.

## Public constructors

### ConcatAdapter

```
@SafeVarargs
ConcatAdapter(
    adapters: Array<RecyclerView.Adapter<RecyclerView.ViewHolder!>!>
)
```

Creates a ConcatAdapter with `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter.Config#DEFAULT()` and the given adapters in the given order.

| Parameters |
|---|---|
| `adapters: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter<https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder!>!>` | The list of adapters to add |

### ConcatAdapter

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

```
ConcatAdapter(
    adapters: (Mutable)List<RecyclerView.Adapter<RecyclerView.ViewHolder!>!>
)
```

Creates a ConcatAdapter with `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter.Config#DEFAULT()` and the given adapters in the given order.

| Parameters |
|---|---|
| `adapters: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter<https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder!>!>` | The list of adapters to add |

### ConcatAdapter

```
@SafeVarargs
ConcatAdapter(
    config: ConcatAdapter.Config,
    adapters: Array<RecyclerView.Adapter<RecyclerView.ViewHolder!>!>
)
```

Creates a ConcatAdapter with the given config and the given adapters in the given order.

| Parameters |
|---|---|
| `config: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter.Config` | The configuration for this ConcatAdapter |
| `adapters: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter<https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder!>!>` | The list of adapters to add |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter.Config.Builder` |   |

### ConcatAdapter

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

```
ConcatAdapter(
    config: ConcatAdapter.Config,
    adapters: (Mutable)List<RecyclerView.Adapter<RecyclerView.ViewHolder!>!>
)
```

Creates a ConcatAdapter with the given config and the given adapters in the given order.

| Parameters |
|---|---|
| `config: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter.Config` | The configuration for this ConcatAdapter |
| `adapters: (https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter<https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder!>!>` | The list of adapters to add |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter.Config.Builder` |   |

## Public functions

### addAdapter

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

```
fun addAdapter(adapter: RecyclerView.Adapter<RecyclerView.ViewHolder!>): Boolean
```

Appends the given adapter to the existing list of adapters and notifies the observers of this `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter`.

| Parameters |
|---|---|
| `adapter: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter<https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder!>` | The new adapter to add |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if the adapter is successfully added because it did not already exist, `false` otherwise. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter#addAdapter(int,androidx.recyclerview.widget.RecyclerView.Adapter<? extends androidx.recyclerview.widget.RecyclerView.ViewHolder>)` |   |
| `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter#removeAdapter(androidx.recyclerview.widget.RecyclerView.Adapter<? extends androidx.recyclerview.widget.RecyclerView.ViewHolder>)` |   |

### addAdapter

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

```
fun addAdapter(
    index: Int,
    adapter: RecyclerView.Adapter<RecyclerView.ViewHolder!>
): Boolean
```

Adds the given adapter to the given index among other adapters that are already added.

| Parameters |
|---|---|
| `index: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The index into which to insert the adapter. ConcatAdapter will throw an `https://developer.android.com/reference/java/lang/IndexOutOfBoundsException.html` if the index is not between 0 and current adapter count (inclusive). |
| `adapter: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter<https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder!>` | The new adapter to add to the adapters list. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if the adapter is successfully added because it did not already exist, `false` otherwise. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter#addAdapter(androidx.recyclerview.widget.RecyclerView.Adapter<? extends androidx.recyclerview.widget.RecyclerView.ViewHolder>)` |   |
| `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter#removeAdapter(androidx.recyclerview.widget.RecyclerView.Adapter<? extends androidx.recyclerview.widget.RecyclerView.ViewHolder>)` |   |

### findRelativeAdapterPositionIn

```
fun findRelativeAdapterPositionIn(
    adapter: RecyclerView.Adapter<RecyclerView.ViewHolder!>,
    viewHolder: RecyclerView.ViewHolder,
    localPosition: Int
): Int
```

Returns the position of the given `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder` in the given `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter`. If the given `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter` is not part of this `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter`, `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView#NO_POSITION()` is returned.

| Parameters |
|---|---|
| `adapter: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter<https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder!>` | The adapter which is a sub adapter of this ConcatAdapter or itself. |
| `viewHolder: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder` | The view holder whose local position in the given adapter will be returned. |
| `localPosition: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The position of the given `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder` in this `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter`. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The local position of the given `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder` in the given `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter` or `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView#NO_POSITION()` if the `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder` is not bound to an item or the given `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter` is not part of this ConcatAdapter. |

### getAdapters

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

```
fun getAdapters(): (Mutable)List<RecyclerView.Adapter<RecyclerView.ViewHolder!>!>
```

Returns an unmodifiable copy of the list of adapters in this `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter`. Note that this is a copy hence future changes in the ConcatAdapter are not reflected in this list.

| Returns |
|---|---|
| `(https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter<https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder!>!>` | A copy of the list of adapters in this ConcatAdapter. |

### getItemCount

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

```
fun getItemCount(): Int
```

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. |

### getItemId

```
fun getItemId(position: Int): Long
```

Return the stable ID for the item at `position`. If `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#hasStableIds()` would return false this method should return `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView#NO_ID()`. The default implementation of this method returns `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView#NO_ID()`.

| Parameters |
|---|---|
| `position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Adapter position to query |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` | the stable ID of the item at position |

### getItemViewType

```
fun getItemViewType(position: Int): Int
```

Return the view type of the item at `position` for the purposes of view recycling.

The default implementation of this method returns 0, making the assumption of a single view type for the adapter. Unlike ListView adapters, types need not be contiguous. Consider using id resources to uniquely identify item view types.

| Parameters |
|---|---|
| `position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | position to query |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | integer value identifying the type of the view needed to represent the item at `position`. Type codes need not be contiguous. |

### getWrappedAdapterAndPosition

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

```
fun getWrappedAdapterAndPosition(globalPosition: Int): Pair<RecyclerView.Adapter<RecyclerView.ViewHolder!>!, Int!>
```

Retrieve the adapter and local position for a given position in this `ConcatAdapter`. This allows for retrieving wrapped adapter information in situations where you don't have a `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder`, such as within a `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/GridLayoutManager.SpanSizeLookup` in which you want to look up information from the source adapter.

| Parameters |
|---|---|
| `globalPosition: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The position in this `ConcatAdapter`. |

| Returns |
|---|---|
| `https://developer.android.com/reference/android/util/Pair.html<https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter<https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder!>!, https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html!>` | a Pair with the first element set to the wrapped `Adapter` containing that position and the second element set to the local position in the wrapped adapter |

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException.html` | if the specified `globalPosition` does not correspond to a valid element of this adapter. That is, if `globalPosition` is less than 0 or greater than the total number of items in the `ConcatAdapter` |

### onAttachedToRecyclerView

```
fun onAttachedToRecyclerView(recyclerView: RecyclerView): Unit
```

Called by RecyclerView when it starts observing this Adapter.

Keep in mind that same adapter may be observed by multiple RecyclerViews.

| Parameters |
|---|---|
| `recyclerView: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView` | The RecyclerView instance which started observing this adapter. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#onDetachedFromRecyclerView(androidx.recyclerview.widget.RecyclerView)` |   |

### onBindViewHolder

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

```
fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int): Unit
```

Called by RecyclerView to display the data at the specified position. This method should update the contents of the `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder#itemView()` to reflect the item at the given position.

Note that unlike `https://developer.android.com/reference/android/widget/ListView.html`, RecyclerView will not call this method again if the position of the item changes in the data set unless the item itself is invalidated or the new position cannot be determined. For this reason, you should only use the `position` parameter while acquiring the related data item inside this method and should not keep a copy of it. If you need the position of an item later on (e.g. in a click listener), use `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder#getBindingAdapterPosition()` which will have the updated adapter position. Override `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#onBindViewHolder(VH,int,java.util.List<java.lang.Object>)` instead if Adapter can handle efficient partial bind.

| Parameters |
|---|---|
| `holder: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder` | The ViewHolder which should be updated to represent the contents of the item at the given position in the data set. |
| `position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The position of the item within the adapter's data set. |

### onCreateViewHolder

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

```
fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder
```

Called when RecyclerView needs a new `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder` of the given type to represent an item.

This new ViewHolder should be constructed with a new View that can represent the items of the given type. You can either create a new View manually or inflate it from an XML layout file.

The new ViewHolder will be used to display items of the adapter using `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#onBindViewHolder(VH,int,java.util.List<java.lang.Object>)`. Since it will be re-used to display different items in the data set, it is a good idea to cache references to sub views of the View to avoid unnecessary `https://developer.android.com/reference/android/view/View.html#findViewById(int)` calls.

| Parameters |
|---|---|
| `parent: https://developer.android.com/reference/android/view/ViewGroup.html` | The ViewGroup into which the new View will be added after it is bound to an adapter position. |
| `viewType: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The view type of the new View. |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder` | A new ViewHolder that holds a View of the given view type. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#getItemViewType(int)` |   |
| `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#onBindViewHolder(VH,int)` |   |

### onDetachedFromRecyclerView

```
fun onDetachedFromRecyclerView(recyclerView: RecyclerView): Unit
```

Called by RecyclerView when it stops observing this Adapter.

| Parameters |
|---|---|
| `recyclerView: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView` | The RecyclerView instance which stopped observing this adapter. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#onAttachedToRecyclerView(androidx.recyclerview.widget.RecyclerView)` |   |

### onFailedToRecycleView

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

```
fun onFailedToRecycleView(holder: RecyclerView.ViewHolder): Boolean
```

Called by the RecyclerView if a ViewHolder created by this Adapter cannot be recycled due to its transient state. Upon receiving this callback, Adapter can clear the animation(s) that effect the View's transient state and return `true` so that the View can be recycled. Keep in mind that the View in question is already removed from the RecyclerView.

In some cases, it is acceptable to recycle a View although it has transient state. Most of the time, this is a case where the transient state will be cleared in `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#onBindViewHolder(VH,int)` call when View is rebound to a new position. For this reason, RecyclerView leaves the decision to the Adapter and uses the return value of this method to decide whether the View should be recycled or not.

Note that when all animations are created by `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ItemAnimator`, you should never receive this callback because RecyclerView keeps those Views as children until their animations are complete. This callback is useful when children of the item views create animations which may not be easy to implement using an `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ItemAnimator`.

You should *never* fix this issue by calling `holder.itemView.setHasTransientState(false);` unless you've previously called `holder.itemView.setHasTransientState(true);`. Each `View.setHasTransientState(true)` call must be matched by a `View.setHasTransientState(false)` call, otherwise, the state of the View may become inconsistent. You should always prefer to end or cancel animations that are triggering the transient state instead of handling it manually.

| Parameters |
|---|---|
| `holder: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder` | The ViewHolder containing the View that could not be recycled due to its transient state. |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | True if the View should be recycled, false otherwise. Note that if this method returns `true`, RecyclerView *will ignore* the transient state of the View and recycle it regardless. If this method returns `false`, RecyclerView will check the View's transient state again before giving a final decision. Default implementation returns false. |

### onViewAttachedToWindow

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

```
fun onViewAttachedToWindow(holder: RecyclerView.ViewHolder): Unit
```

Called when a view created by this adapter has been attached to a window.

This can be used as a reasonable signal that the view is about to be seen by the user. If the adapter previously freed any resources in `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter#onViewDetachedFromWindow(VH)` those resources should be restored here.

| Parameters |
|---|---|
| `holder: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder` | Holder of the view being attached |

### onViewDetachedFromWindow

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

```
fun onViewDetachedFromWindow(holder: RecyclerView.ViewHolder): Unit
```

Called when a view created by this adapter has been detached from its window.

Becoming detached from the window is not necessarily a permanent condition; the consumer of an Adapter's views may choose to cache views offscreen while they are not visible, attaching and detaching them as appropriate.

| Parameters |
|---|---|
| `holder: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder` | Holder of the view being detached |

### onViewRecycled

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

```
fun onViewRecycled(holder: RecyclerView.ViewHolder): Unit
```

Called when a view created by this adapter has been recycled.

A view is recycled when a `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.LayoutManager` decides that it no longer needs to be attached to its parent `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView`. This can be because it has fallen out of visibility or a set of cached views represented by views still attached to the parent RecyclerView. If an item view has large or expensive data bound to it such as large bitmaps, this may be a good place to release those resources.

RecyclerView calls this method right before clearing ViewHolder's internal data and sending it to RecycledViewPool. This way, if ViewHolder was holding valid information before being recycled, you can call `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder#getBindingAdapterPosition()` to get its adapter position.

| Parameters |
|---|---|
| `holder: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder` | The ViewHolder for the view being recycled |

### removeAdapter

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

```
fun removeAdapter(adapter: RecyclerView.Adapter<RecyclerView.ViewHolder!>): Boolean
```

Removes the given adapter from the adapters list if it exists

| Parameters |
|---|---|
| `adapter: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter<https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.ViewHolder!>` | The adapter to remove |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `true` if the adapter was previously added to this `ConcatAdapter` and now removed or `false` if it couldn't be found. |

### setHasStableIds

```
fun setHasStableIds(hasStableIds: Boolean): Unit
```

Calling this method is an error and will result in an `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html`. You should use the `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter.Config` object passed into the ConcatAdapter to configure this behavior.

| Parameters |
|---|---|
| `hasStableIds: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | Whether items in data set have unique identifiers or not. |

### setStateRestorationPolicy

```
fun setStateRestorationPolicy(
    strategy: RecyclerView.Adapter.StateRestorationPolicy
): Unit
```

Calling this method is an error and will result in an `https://developer.android.com/reference/java/lang/UnsupportedOperationException.html`. ConcatAdapter infers this value from added `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter`s.

| Parameters |
|---|---|
| `strategy: https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter.StateRestorationPolicy` | The saved state restoration strategy for this Adapter such that `https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/ConcatAdapter` will allow state restoration only if all added adapters allow it or there are no adapters. |