vendredi 18 mai 2018

MVVM design pattern practical observations in android

I am trying to understand MVVM design pattern practically in Android and went through this link and few other links and made some observation.I want to know that are all below observations are correct for implementing MVVM design pattern practically?

1.MVVM can be implemented either by using Data Binding Library or using RxJava.

2.We will create a View Model class which contains methods for various actions we need to perform when user interact with view.It will also interact with Model and saves required data in ObservableField and ObservableArray which needs to be displayed in View .

3.View consist of Actvity/fragments.View will bind UI components in layouts to ViewModel using Data Binding Library.

4.Whenever data changes in in ObservableField and ObservableArray , our View will automatically updated through data binding.

5.We will create an object of ViewModel inside Activity and whenever user interact with view we will call appropriate method of ViewModel to perform action.

Aucun commentaire:

Enregistrer un commentaire