You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When trying to encapsulate some behavior in a View instead of an Activity or a Fragment, I do not have access to the ViewModelProvider. What would be the mot appropriate way of having the same architecture when using Views?
I can see at least 4 options.
Pass the ViewModelProvider as an argument to the View constructor
Pass the already obtained ViewModel as an argument to the View constructor
Pass a LifecycleOwner as an argument to the View constructor
Hold the ViewModel in the containing Fragment/Activity and expose events from the view and consume states.
The text was updated successfully, but these errors were encountered:
When trying to encapsulate some behavior in a View instead of an Activity or a Fragment, I do not have access to the ViewModelProvider. What would be the mot appropriate way of having the same architecture when using Views?
I can see at least 4 options.
The text was updated successfully, but these errors were encountered: