Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# ListUpdateCallback\n\nadded in [version 25.1.0](/topic/libraries/support-library/revisions) \nbelongs to Maven artifact com.android.support:recyclerview-v7:28.0.0-alpha1 \nSummary: [Methods](#pubmethods) \\| [\\[Expand All\\]](#) \n\nListUpdateCallback\n==================\n\n| This package is part of the Android [support library](/topic/libraries/support-library) which is no longer maintained. The support library has been superseded by [AndroidX](/jetpack/androidx) which is part of [Jetpack](/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider [migrating](/jetpack/androidx/migrate) existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library [class\n| mappings](/jetpack/androidx/migrate/class-mappings).\n\n\n`\npublic\n\n\ninterface\nListUpdateCallback\n`\n\n\n`\n\n\n`\n\n|--------------------------------------------|\n| android.support.v7.util.ListUpdateCallback |\n\n|---|---|\n| Known Indirect Subclasses [AdapterListUpdateCallback](/reference/android/support/v7/util/AdapterListUpdateCallback),[BatchingListUpdateCallback](/reference/android/support/v7/util/BatchingListUpdateCallback),[SortedList.BatchedCallback](/reference/android/support/v7/util/SortedList.BatchedCallback)\\\u003cT2\\\u003e,[SortedList.Callback](/reference/android/support/v7/util/SortedList.Callback)\\\u003cT2\\\u003e,[SortedListAdapterCallback](/reference/android/support/v7/widget/util/SortedListAdapterCallback)\\\u003cT2\\\u003e |--------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [AdapterListUpdateCallback](/reference/android/support/v7/util/AdapterListUpdateCallback) | ListUpdateCallback that dispatches update events to the given adapter. | | [BatchingListUpdateCallback](/reference/android/support/v7/util/BatchingListUpdateCallback) | Wraps a [ListUpdateCallback](/reference/android/support/v7/util/ListUpdateCallback) callback and batches operations that can be merged. | | [SortedList.BatchedCallback](/reference/android/support/v7/util/SortedList.BatchedCallback)\\\u003cT2\\\u003e | A callback implementation that can batch notify events dispatched by the SortedList. | | [SortedList.Callback](/reference/android/support/v7/util/SortedList.Callback)\\\u003cT2\\\u003e | The class that controls the behavior of the [SortedList](/reference/android/support/v7/util/SortedList). | | [SortedListAdapterCallback](/reference/android/support/v7/widget/util/SortedListAdapterCallback)\\\u003cT2\\\u003e | A [SortedList.Callback](/reference/android/support/v7/util/SortedList.Callback) implementation that can bind a [SortedList](/reference/android/support/v7/util/SortedList) to a [RecyclerView.Adapter](/reference/android/support/v7/widget/RecyclerView.Adapter). | ||\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nAn interface that can receive Update operations that are applied to a list.\n\n\nThis class can be used together with DiffUtil to detect changes between two lists.\n\nSummary\n-------\n\n| ### Public methods ||\n|------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract void` | ` `[onChanged](/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. |\n| ` abstract void` | ` `[onInserted](/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. |\n| ` abstract void` | ` `[onMoved](/reference/android/support/v7/util/ListUpdateCallback#onMoved(int, int))`(int fromPosition, int toPosition) ` Called when an item changes its position in the list. |\n| ` abstract void` | ` `[onRemoved](/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. |\n\nPublic methods\n--------------\n\n### onChanged\n\nadded in [version 25.1.0](/topic/libraries/support-library/revisions) \n\n```\nvoid onChanged (int position, \n int count, \n Object payload)\n```\n\nCalled when `count` number of items are updated at the given position.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|------------|----------------------------------------------------------------|\n| `position` | `int`: The position of the item which has been updated. \u003cbr /\u003e |\n| `count` | `int`: The number of items which has changed. \u003cbr /\u003e |\n| `payload` | `Object` \u003cbr /\u003e |\n\n### onInserted\n\nadded in [version 22.1.0](/topic/libraries/support-library/revisions) \n\n```\nvoid onInserted (int position, \n int count)\n```\n\nCalled when `count` number of items are inserted at the given position.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|------------|---------------------------------------------------------|\n| `position` | `int`: The position of the new item. \u003cbr /\u003e |\n| `count` | `int`: The number of items that have been added. \u003cbr /\u003e |\n\n### onMoved\n\nadded in [version 22.1.0](/topic/libraries/support-library/revisions) \n\n```\nvoid onMoved (int fromPosition, \n int toPosition)\n```\n\nCalled when an item changes its position in the list.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|----------------|------------------------------------------------------------------|\n| `fromPosition` | `int`: The previous position of the item before the move. \u003cbr /\u003e |\n| `toPosition` | `int`: The new position of the item. \u003cbr /\u003e |\n\n### onRemoved\n\nadded in [version 22.1.0](/topic/libraries/support-library/revisions) \n\n```\nvoid onRemoved (int position, \n int count)\n```\n\nCalled when `count` number of items are removed from the given position.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|------------|----------------------------------------------------------------|\n| `position` | `int`: The position of the item which has been removed. \u003cbr /\u003e |\n| `count` | `int`: The number of items which have been removed. \u003cbr /\u003e |\n\n-\n\n Interfaces\n ----------\n\n - [ListUpdateCallback](/reference/android/support/v7/util/ListUpdateCallback)\n-\n\n Classes\n -------\n\n - [AdapterListUpdateCallback](/reference/android/support/v7/util/AdapterListUpdateCallback)\n - [AsyncListUtil](/reference/android/support/v7/util/AsyncListUtil)\n - [AsyncListUtil.DataCallback](/reference/android/support/v7/util/AsyncListUtil.DataCallback)\n - [AsyncListUtil.ViewCallback](/reference/android/support/v7/util/AsyncListUtil.ViewCallback)\n - [BatchingListUpdateCallback](/reference/android/support/v7/util/BatchingListUpdateCallback)\n - [DiffUtil](/reference/android/support/v7/util/DiffUtil)\n - [DiffUtil.Callback](/reference/android/support/v7/util/DiffUtil.Callback)\n - [DiffUtil.DiffResult](/reference/android/support/v7/util/DiffUtil.DiffResult)\n - [DiffUtil.ItemCallback](/reference/android/support/v7/util/DiffUtil.ItemCallback)\n - [SortedList](/reference/android/support/v7/util/SortedList)\n - [SortedList.BatchedCallback](/reference/android/support/v7/util/SortedList.BatchedCallback)\n - [SortedList.Callback](/reference/android/support/v7/util/SortedList.Callback)"]]