at androidx.navigation.NavController.navigate(NavController.java:789) at androidx.navigation.NavController.navigate(NavController.java:730) at androidx.navigation.NavController.navigate(NavController.java:716) at androidx.navigation.NavController.navigate(NavController.java:704) at com.github.lcdsmao.uievent.FooFragment$onCreateView$$inlined$apply$lambda$1.onClick(FooFragment.kt:22) at android.view.View.performClick(View.java:6256) at android.view.View$PerformClick.run(View.java:24710) at android.os.Handler.handleCallback(Handler.java:789) at android.os.Handler.dispatchMessage(Handler.java:98) at android.os.Looper.loop(Looper.java:251) at android.app.ActivityThread.main(ActivityThread.java:6572) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767) This exception occurs when calling Action that does not belong to the current Fragment
navId: Int = 0 protected fun navigate(@IdRes destId: Int) { require(navId != 0) { "Need fragment id in navGraph for safe navigation" } findNavController().safeNavigate(desId) } }
navId: Int = 0 protected fun navigate(@IdRes destId: Int) { require(navId != 0) { "Need fragment id in navGraph for safe navigation" } if (viewLifecycleOwner.lifecycle.currentState.isAtLeast(Lifecycle.State.RESUMED)) { findNavController().safeNavigate(desId) } } }