# AdapterListUpdateCallback

# AdapterListUpdateCallback

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

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/recyclerview/widget/AdapterListUpdateCallback "View this page in Java")

<br />

```
class AdapterListUpdateCallback : ListUpdateCallback
```

<br />

*** ** * ** ***

ListUpdateCallback that dispatches update events to the given adapter.  

|                                                                                         See also                                                                                          |
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [dispatchUpdatesTo](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/DiffUtil.DiffResult#dispatchUpdatesTo(androidx.recyclerview.widget.RecyclerView.Adapter)) |   |

## Summary

|                                                                                                                                                                                                              ### Public constructors                                                                                                                                                                                                               |
|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [AdapterListUpdateCallback](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/AdapterListUpdateCallback#AdapterListUpdateCallback(androidx.recyclerview.widget.RecyclerView.Adapter))`(adapter: `[RecyclerView.Adapter](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter)`)` Creates an AdapterListUpdateCallback that will dispatch update events to the given adapter. |

|                             ### Public functions                              |
|-------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onChanged](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/AdapterListUpdateCallback#onChanged(int,int,java.lang.Object))`(position: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, count: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, payload: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`!)` Called when count} number of items are updated at the given position. |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onInserted](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/AdapterListUpdateCallback#onInserted(int,int))`(position: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, count: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Called when count} number of items are inserted at the given position.                                                                                                        |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onMoved](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/AdapterListUpdateCallback#onMoved(int,int))`(fromPosition: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, toPosition: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Called when an item changes its position in the list.                                                                                                                      |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html) | [onRemoved](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/AdapterListUpdateCallback#onRemoved(int,int))`(position: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, count: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` Called when count} number of items are removed from the given position.                                                                                                         |

## Public constructors

### AdapterListUpdateCallback

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

```
AdapterListUpdateCallback(adapter: RecyclerView.Adapter)
```

Creates an AdapterListUpdateCallback that will dispatch update events to the given adapter.  

|                                                             Parameters                                                              |
|-------------------------------------------------------------------------------------------------------------------------------------|---------------------------------|
| `adapter: `[RecyclerView.Adapter](https://developer.android.com/reference/kotlin/androidx/recyclerview/widget/RecyclerView.Adapter) | The Adapter to send updates to. |

## Public functions

### onChanged

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

```
fun onChanged(position: Int, count: Int, payload: Any!): Unit
```

Called when count} number of items are updated at the given position.  

### onInserted

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

```
fun onInserted(position: Int, count: Int): Unit
```

Called when count} number of items are inserted at the given position.  

### onMoved

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

```
fun onMoved(fromPosition: Int, toPosition: Int): Unit
```

Called when an item changes its position in the list.  

### onRemoved

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

```
fun onRemoved(position: Int, count: Int): Unit
```

Called when count} number of items are removed from the given position.