Sign in Go Pro

RecyclerView

Animate Complex Content Changes with DiffUtil

This lesson is for PRO members.

Upgrade today to get access to all the PRO lessons.

Unlock this lesson

Previous

About

`DiffUtil` is a new feature of the AppCompat library that makes it easier to understand how to animate complex data changes in a RecyclerView. Previously, if you wanted to use animations it was necessary to know details about the changes in your data, so you could chose the correct notify methods. You can use this tool to figure out the details of your changes, and it will apply the correct animations automatically. I will show you how to create a custom `DiffUtil.Callback`, which is class used by the system to compare objects in a list. You will customize this class, based on your data and use case, then the system will use this class to automatically figure out the changes in your list, and apply the correct animations as appropriate. [Official Docs](https://developer.android.com/reference/android/support/v7/util/DiffUtil.html)

Lessons in RecyclerView