Here, Thompson Nsikak Provides a primary understanding of the MVVM Pattern with most insights on ViewModels and how they work with persistence, onSavedInstanceState() and RestoringUI state.
you don’t want to lose if you open and close the activity. • ViewModels are used for storing all the data needed to display the associated UI Controller. • onSaveInstanceState is used for storing a small amount of data needed to easily reload activity state if the UI Controller is stopped and recreated by the system. E.g search query