i am trying to do global navigation to fragment from activity but getting exception
java.lang.IllegalArgumentException: Navigation action/destination com.android:id/action_global_serviceUnavailableFragment cannot be found from the current destination Destination(com.android:id/authFragment) label=fragment_auth class=com.android.ui.auth.AuthFragment
the fragment I want to navigate to is in another graph, but I don't think it should affect
my code :
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/service_unavailable_graph"
app:startDestination="@id/serviceUnavailableFragment">
<fragment
android:id="@+id/serviceUnavailableFragment"
android:name="com.android.ui.serviceunavailable.ServiceUnavailableFragment"
android:label="fragment_service_unavailable"
tools:layout="@layout/fragment_service_unavailable">
</fragment>
<action
android:id="@+id/action_global_serviceUnavailableFragment"
app:destination="@id/serviceUnavailableFragment" />
</navigation>
override fun serviceUnavailable() {
lifecycle.coroutineScope.launch(Dispatchers.Main) {
navController.navigate(R.id.action_global_serviceUnavailableFragment)
}
}