It is a very simple example of ViewModel. ViewModel helps you keep your UI data available for the whole lifecycle of your activity and fragment. Even if your activity get restarted and you are using the ViewModel you don't need to featch data again from network,Internet or local device. You can check out the compleate tutorial of this example at https://www.nplix.com/2018/01/08/use-view-model-architecture-components-preserve-data-activity-fragment/