How do you use Viewmodels?

Ngô Quốc Huy

New member
How do you use Viewmodels?
Answer
There are four main steps in creating and using a ViewModel :
  1. Add dependencies in your app-level build. …
  2. Separate out all your data from your activity by creating a class that extends the ViewModel .
  3. Create a ViewModel instance in your activity to use it.
  4. Set up communications between your ViewModel and your View layer.
2 февр. 2020 г.
 

Tìm kiếm

Back
Top