Home » Android » Android ViewModel for a custom view

Android ViewModel for a custom view

Posted by: admin May 14, 2020 Leave a comment

Questions:

I would like to refactor my Custom View to use android architecture components. However, I see that

ViewModelProviders.of(...)

takes only Activity or fragment. Any idea how to make it work? Should I use fragment instead of Custom View?

How to&Answers: