Open solareye opened 4 years ago
Reproduced same (or similar issue?) with these steps:
The way I fixed it - where I pop fragment B, I also added a call to clearDialogFragment
BEFORE popping B.
p.s. The Exception I received was:
07-20 19:04:13.399 5688-5688/***.*** E/AndroidRuntime: FATAL EXCEPTION: main
Process: ***.***, PID: 5688
java.lang.IllegalStateException: Fragment ConfirmDialog{b5bf4bc (6e206fd7-1e27-4cee-ab7d-aa00101dbbac)} not associated with a fragment manager.
at androidx.fragment.app.Fragment.requireFragmentManager(Fragment.java:910)
at androidx.fragment.app.DialogFragment.dismissInternal(DialogFragment.java:245)
at androidx.fragment.app.DialogFragment.dismiss(DialogFragment.java:202)
at com.ncapdevi.fragnav.FragNavController.clearDialogFragment(FragNavController.kt:464)
at com.ncapdevi.fragnav.FragNavController.showDialogFragment(FragNavController.kt:483)
at ***.***.common.fragments.ScreenNavigator.addDialog(ScreenNavigator.kt:49)
at ***.***.***.***SomeFragment***.onPop(***SomeFragment***.kt:97)
at ***.***.common.fragments.ScreenNavigator.pop(ScreenNavigator.kt:61)
at ***.***.common.activities.BaseActivity.onBackPressed(BaseActivity.kt:28)
at ***.***.common.activities.MainActivity$onStart$1.onClick(MainActivity.kt:39)
at android.view.View.performClick(View.java:5198)
at android.view.View$PerformClick.run(View.java:21147)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
I have FragNavController in my activity. When I call showDialogFragment like
fun BaseFragment.showDialogFragment( bottomFragment: BottomSheetDialogFragment, requestCode: Int = 0 ) { bottomFragment.setTargetFragment(this, requestCode) this.baseActivity().fragNav?.showDialogFragment(bottomFragment) }
app crashed with