Ngô Quốc Huy
New member
How do you use Viewmodels?
Answer
There are four main steps in creating and using a ViewModel :
Answer
There are four main steps in creating and using a ViewModel :
- Add dependencies in your app-level build. …
- Separate out all your data from your activity by creating a class that extends the ViewModel .
- Create a ViewModel instance in your activity to use it.
- Set up communications between your ViewModel and your View layer.