# ListUpdateCallback

added in[version 25.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  
belongs to Maven artifact com.android.support:recyclerview-v7:28.0.0-alpha1  
Summary:[Methods](https://developer.android.com/reference/android/support/v7/util/ListUpdateCallback#pubmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/v7/util/ListUpdateCallback#)  

# ListUpdateCallback

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public


interface
ListUpdateCallback
`  
`


`

|--------------------------------------------|
| android.support.v7.util.ListUpdateCallback |

|---|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v7/util/ListUpdateCallback#)Known Indirect Subclasses [AdapterListUpdateCallback](https://developer.android.com/reference/android/support/v7/util/AdapterListUpdateCallback),[BatchingListUpdateCallback](https://developer.android.com/reference/android/support/v7/util/BatchingListUpdateCallback),[SortedList.BatchedCallback](https://developer.android.com/reference/android/support/v7/util/SortedList.BatchedCallback)\<T2\>,[SortedList.Callback](https://developer.android.com/reference/android/support/v7/util/SortedList.Callback)\<T2\>,[SortedListAdapterCallback](https://developer.android.com/reference/android/support/v7/widget/util/SortedListAdapterCallback)\<T2\> |-------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [AdapterListUpdateCallback](https://developer.android.com/reference/android/support/v7/util/AdapterListUpdateCallback)              | ListUpdateCallback that dispatches update events to the given adapter.                                                                                                                                                                                                                                                                               | | [BatchingListUpdateCallback](https://developer.android.com/reference/android/support/v7/util/BatchingListUpdateCallback)            | Wraps a[ListUpdateCallback](https://developer.android.com/reference/android/support/v7/util/ListUpdateCallback)callback and batches operations that can be merged.                                                                                                                                                                                   | | [SortedList.BatchedCallback](https://developer.android.com/reference/android/support/v7/util/SortedList.BatchedCallback)\<T2\>      | A callback implementation that can batch notify events dispatched by the SortedList.                                                                                                                                                                                                                                                                 | | [SortedList.Callback](https://developer.android.com/reference/android/support/v7/util/SortedList.Callback)\<T2\>                    | The class that controls the behavior of the[SortedList](https://developer.android.com/reference/android/support/v7/util/SortedList).                                                                                                                                                                                                                 | | [SortedListAdapterCallback](https://developer.android.com/reference/android/support/v7/widget/util/SortedListAdapterCallback)\<T2\> | A[SortedList.Callback](https://developer.android.com/reference/android/support/v7/util/SortedList.Callback)implementation that can bind a[SortedList](https://developer.android.com/reference/android/support/v7/util/SortedList)to a[RecyclerView.Adapter](https://developer.android.com/reference/android/support/v7/widget/RecyclerView.Adapter). | ||

<br />

*** ** * ** ***

An interface that can receive Update operations that are applied to a list.

This class can be used together with DiffUtil to detect changes between two lists.

## Summary

|                                                                                                                             ### Public methods                                                                                                                              ||
|------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` abstract void` | ` `[onChanged](https://developer.android.com/reference/android/support/v7/util/ListUpdateCallback#onChanged(int, int, java.lang.Object))`(int position, int count, Object payload) ` Called when`count`number of items are updated at the given position. |
| ` abstract void` | ` `[onInserted](https://developer.android.com/reference/android/support/v7/util/ListUpdateCallback#onInserted(int, int))`(int position, int count) ` Called when`count`number of items are inserted at the given position.                                |
| ` abstract void` | ` `[onMoved](https://developer.android.com/reference/android/support/v7/util/ListUpdateCallback#onMoved(int, int))`(int fromPosition, int toPosition) ` Called when an item changes its position in the list.                                             |
| ` abstract void` | ` `[onRemoved](https://developer.android.com/reference/android/support/v7/util/ListUpdateCallback#onRemoved(int, int))`(int position, int count) ` Called when`count`number of items are removed from the given position.                                 |

## Public methods

### onChanged

added in[version 25.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void onChanged (int position, 
                int count, 
                Object payload)
```

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

<br />

|                                 Parameters                                 ||
|------------|----------------------------------------------------------------|
| `position` | `int`: The position of the item which has been updated. <br /> |
| `count`    | `int`: The number of items which has changed. <br />           |
| `payload`  | `Object` <br />                                                |

### onInserted

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void onInserted (int position, 
                int count)
```

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

<br />

|                             Parameters                              ||
|------------|---------------------------------------------------------|
| `position` | `int`: The position of the new item. <br />             |
| `count`    | `int`: The number of items that have been added. <br /> |

### onMoved

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void onMoved (int fromPosition, 
                int toPosition)
```

Called when an item changes its position in the list.

<br />

|                                    Parameters                                    ||
|----------------|------------------------------------------------------------------|
| `fromPosition` | `int`: The previous position of the item before the move. <br /> |
| `toPosition`   | `int`: The new position of the item. <br />                      |

### onRemoved

added in[version 22.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void onRemoved (int position, 
                int count)
```

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

<br />

|                                 Parameters                                 ||
|------------|----------------------------------------------------------------|
| `position` | `int`: The position of the item which has been removed. <br /> |
| `count`    | `int`: The number of items which have been removed. <br />     |

-

  ## Interfaces

  - [ListUpdateCallback](https://developer.android.com/reference/android/support/v7/util/ListUpdateCallback)
-

  ## Classes

  - [AdapterListUpdateCallback](https://developer.android.com/reference/android/support/v7/util/AdapterListUpdateCallback)
  - [AsyncListUtil](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil)
  - [AsyncListUtil.DataCallback](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil.DataCallback)
  - [AsyncListUtil.ViewCallback](https://developer.android.com/reference/android/support/v7/util/AsyncListUtil.ViewCallback)
  - [BatchingListUpdateCallback](https://developer.android.com/reference/android/support/v7/util/BatchingListUpdateCallback)
  - [DiffUtil](https://developer.android.com/reference/android/support/v7/util/DiffUtil)
  - [DiffUtil.Callback](https://developer.android.com/reference/android/support/v7/util/DiffUtil.Callback)
  - [DiffUtil.DiffResult](https://developer.android.com/reference/android/support/v7/util/DiffUtil.DiffResult)
  - [DiffUtil.ItemCallback](https://developer.android.com/reference/android/support/v7/util/DiffUtil.ItemCallback)
  - [SortedList](https://developer.android.com/reference/android/support/v7/util/SortedList)
  - [SortedList.BatchedCallback](https://developer.android.com/reference/android/support/v7/util/SortedList.BatchedCallback)
  - [SortedList.Callback](https://developer.android.com/reference/android/support/v7/util/SortedList.Callback)