Learning Android Development
Passing Activity Intent Data to ViewModel through Injection
Passing Everything to ViewModel without Activity involvement.
Published in
4 min readJul 2, 2020
Since 2017 till now, with Architecture Component in place, ViewModel had come a long way. It is starting to replace Activity/Fragment as the core of the view, having the ability to interact with Views, able to emit signal using LiveData, and of last year able to Saved State.
This year, with Dagger Hilt, it now has the ability to be injected with Dependencies without involvement from the Activities.
Injecting ViewModel with Dagger Hilt
No more Factory Needed for ViewModel with Dependencies
medium.com
However, with the above solution, nothing was mentioned about how we handle the Intent Data an activity received, to be sent to the ViewModel.