I am trying to implement jetpack navigation on my android app. I have created a navigational graph as shown below:

and navigational drawer menu xml as shown below:

according to the documentation in the android developer site, here
giving the menu items the same id as the fragments or destinations should be enough to ensure that clicking on an menu item will navigate me to the specified fragment. This doesn't seem to work, am I missing something?
@Dracarys You should use
implementation "android.arch.navigation:navigation-ui-ktx:1.0.0-alpha04"
instead of
implementation "android.arch.navigation:navigation-ui:1.0.0-alpha04"
pay attention to -ktx part in case if you are using Kotlin. Then you will see navigationView.setupWithNavController(navController) method
[UPD 1]
Also, I faced with same issue, when I get navController by calling findNavController(view). Try to use findNavController(activity, id) and pass it to setupWithNavController(navController) method. It works for me now
According to the docs, there's a piece of code wiring you need to do:
NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
NavigationUI.setupWithNavController(navigationView, navController);
or in kotlin:
val navigationView = findViewById(R.id.nav_view)
navigationView.setupWithNavController(navController)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With