5
votes

There is a design pattern called MVVM (Model-View-View Model), in which a View Model is used as an abstraction of a View. The View Model supposed to expose streams of data to the View and interact with Model's data.

However there is a ViewModel class in Android's framework.


Question: does Android's ViewModel have something to do with the View Model from MVVM pattern?

1

1 Answers

1
votes

They are different. The ViewModel that Android is referring to is just.

The ViewModel class is designed to store and manage UI-related data so that the data survives configuration changes such as screen rotations.

The MVVM pattern will require a View, ViewModel and Model. With binding occurring between the View and ViewModel.

The Android ViewModel interacts with the UIController, and is almost just a state hold for UI, rather than following the MVVM pattern.