I have a host (activity) which contains 5 fragments and one of the fragment also acts like a host (nested graph) contains 2 fragments. I want to create a start destination dynamically in this host fragment.
I created the start destination dynamically in activity but can't create in fragment as it can't refer the id of nav host.
In activity I did this:
val navHostFragment = nav_host_fragment as NavHostFragment
val navController = navHostFragment.navController
val navInflater = navController.navInflater
val graph = navInflater.inflate(R.navigation.nav_main)
graph.startDestination = R.id.detail_fragment
val navShipmentId = NavArgument.Builder().setDefaultValue(shipmentId).build()
navHostFragment.navController.graph = graph