getChangePayload

open fun getChangePayload(oldItemPosition: Int, newItemPosition: Int): Any(source)

When areItemsTheSame returns true for two items and areContentsTheSame returns false for them, DiffUtil calls this method to get a payload about the change.

For example, if you are using DiffUtil with RecyclerView, you can return the particular field that changed in the item and your ItemAnimator can use that information to run the correct animation.

Default implementation returns null.

Return

A payload object that represents the change between the two items.

Parameters

oldItemPosition

The position of the item in the old list

newItemPosition

The position of the item in the new list