Question : does not have a NavController set
Answered by : gurmeet-singh-dhillon
val navHostFragment = supportFragmentManager.findFragmentById(R.id.nav_host_fragment) as NavHostFragment
val navController = navHostFragment.navController
Source : https://qa.ostack.cn/qa/?qa=494097/ | Last Update : Tue, 03 May 22
Question : activity does not have a navcontroller set on fragmentcontainerview
Answered by : bloody-batfish-pr4phhrn8dn1
val navHostFragment = supportFragmentManager .findFragmentById(R.id.my_nav_host_fragment) as NavHostFragment
val navController = navHostFragment.navController
Source : https://stackoverflow.com/questions/58703451/fragmentcontainerview-as-navhostfragment | Last Update : Tue, 30 Nov 21
Question : does not have a NavController set
Answered by : gurmeet-singh-dhillon
<androidx.fragment.app.FragmentContainerView android:id="@+id/nav_host_fragment" android:name="androidx.navigation.fragment.NavHostFragment" android:layout_width="0dp" android:layout_height="0dp" app:defaultNavHost="true" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" app:layout_constraintTop_toBottomOf="parent" app:navGraph="@navigation/nav_graph" />
Source : https://qa.ostack.cn/qa/?qa=494097/ | Last Update : Tue, 03 May 22