I am using Navigation from Android Jetpack to navigate between screens. Now I want to set startDestination dynamically.
I have an Activity named MainActivity And t
this is not an answer but Just a replication of @Akash Patel answer in more clean and clear way
// in your MainActivity
navController = findNavController(R.id.nav_host_fragment)
val graph = navController.navInflater.inflate(R.navigation.nav_graph)
if (Authentication.checkUserLoggedIn()) {
graph.startDestination = R.id.homeFragment
} else {
graph.startDestination = R.id.loginFragment
}
navController.graph = graph