How to use @ViewModelInject on a NavGraph-scoped ViewModel?
See original GitHub issueIf there is only ApplicationComponent, ActivityComponent, ActivityRetainedComponent and FragmentComponent, then how do I get a NavGraph-scoped ViewModel with @ViewModelInject
from a NavBackStackEntry?
Sounds like this would only work if there’s a custom component definition and the NavBackStackEntry counts as a @AndroidEntryPoint
, but that doesn’t seem possible. Just a hunch, though, in the sample I’m looking at I’m not even sure why @ViewModelInject
works at all, or how to get additional @Assisted
parameters that are not the SavedStateHandle.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
A step by step guide on how to use Nav-graph Scoped ...
In this article, I will show you how to share viewmodels between fragments in Google's proposed MVVM with a single Activity. WARNING:I won't...
Read more >Hilt creating different instances of view model inside same ...
When you use by viewModels , you are creating a ViewModel scoped to that individual Fragment - this means each Fragment will have...
Read more >How can I create a ViewModel using Hilt which is scoped to ...
I noticed that with Hilt, ViewModels using @ViewModelInject are ... I'm only scoping viewModels using the Nav-graph Scoped ViewModels.
Read more >Hilt ViewModels and Dependency Injection - YouTube
... courses in the world: https://codingwithmitch.com/In this video I show you how to do dependency injection into viewmodels using Hilt.
Read more >Gabor Varadi on Twitter: "NavGraph-scoped ViewModels (for ...
NavGraph-scoped ViewModels (for those who are using Jetpack Navigation) was announced since June 2019, yet most often I still see people scoping their ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just FYI, we’re going to come back to this issue about Hilt after the official launch. Thanks for filing it though and sorry for the wait!
Nice, now I understand Hilt. Cheers.