Learn about ViewModel, LiveData, data binding with ViewModel and LiveData, and LiveData transformations. You complete the GuessTheWord app, which is a two-player charades-style game, in which the players collaborate to achieve the highest score possible.
Import the starter code for the GuessTheWord app. Create a ViewModel that holds the state of the game, such as the list of words, the current word, and the score. Once this data is stored in the ViewModel, the app will maintain its state across configuration changes such as device rotations.
LiveData and LiveData observers
Encapsulate an app's UI data (data to be displayed) using LiveData and MutuableLiveData within a ViewModel. Add an observer onto the LiveData so that when the value of the LiveData changes, the fragment can update its UI.
Data binding with ViewModel and LiveData
Integrate LiveData and ViewModel with data binding so that the views in your layout communicate directly with ViewModel objects, without using the app's fragments to relay information.
Transform LiveData into a different result, and have the UI show the new result every time the underlying LiveData changes.