architecture-components-samples icon indicating copy to clipboard operation
architecture-components-samples copied to clipboard

Navigation between different navgraph fragments + hiltnavgraphVM

Open sdfgsdfgd opened this issue 3 years ago • 1 comments

Hi, similar to the navigation sample I'm using different navigation graphs and the extensions provided in the sample and I need to findController().navigate() between the second fragment of Navgraph A and third fragment of Navgraph B.

Since I'm also using Hilt dependency injection, the navigation graphs are injected with the VM initialisation inside fragments. I don't know how nicely this plays with advanced navigation ? private val viewModel: ExampleViewModel by hiltNavGraphViewModels(R.id.navgraphId)

I noticed I can't just do a global action.... Simply include NavGraph B's fragment in navgraph A and then simply navigate() to it, you get all sorts of errors about the backstackentry or navgraph not being included. How would you navigate in this particular case ?

sdfgsdfgd avatar Mar 29 '21 07:03 sdfgsdfgd

I'm very interested in doing exactly the same thing but haven't yet been able to.

@sdfgsdfgd did you manage to make it work?

nareto avatar Apr 18 '21 15:04 nareto