This is a great question. The next frontier for using this ViewModel pattern with the AbstractSavedStateViewModelFactory, as you mention is injecting the ViewModel entirely.

AssistedInject seems to be a promising method of injecting the ViewModel with Dagger. AssistedInject is on my personal learning roadmap so stay tuned for more in the future.

Manuel Vivo has been publishing good content surrounding Dagger, and it seems like improvements to Dagger for Android are coming. I’d imagine a a simplified approach to injecting ViewModel’s to be a part of those updates.

--

--

Open Sourcer

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Adam Hurwitz

Adam Hurwitz

Open Sourcer

More from Medium

I have heard countless times the saying: LIFE IS A JOURNEY.

The place you choose to live has a greater effect on the overall happiness than the job you choose.

3 Good Things You Can Learn from a Bad Boss | Shellye

Most startups fail due to a marketing problem, not a product problem