MVVM stands for Model-View-View-Model. It is similar to the MVC model, the only difference being it has two-way data binding with the view and view-model. The changes in the view are being propagated via the view-model, which uses an observer pattern to communicate between the view-model and the model. The view in this case is completely isolated from the model.
The major advantage of using MVVM is it enables automatic changes in the view via the view-model:
Figure 2.2.3
MVVM has the following components:
- Model: The model represents the objects in the application. This has the logic of where the data is to be fetched from.
- View: The view is similar to the MVC pattern view, which renders information to users and contains a UI Component .xml file, activity, fragments, and dialog under the View Layer. It does not have any other logic implemented.
- View-model: The view-model...