In the first part, we saw how to create the data model of our app, this time, we’re going to use LiveData & ViewModel to display our todos.

What’s a ViewModel ?

This is the definition you can find here:

The ViewModel class is designed to store and manage UI-related data in a lifecycle conscious way. The ViewModel class allows data to survive configuration changes such as screen rotations.

So basically, ViewModel is here to save you lot of problems when dealing with the Android application lifecycle.