From 1152e37f338b83d080c6f1fcad8c11d29b8b925f Mon Sep 17 00:00:00 2001 From: Gideon Okuro Date: Wed, 10 Jul 2024 14:15:31 +0300 Subject: [PATCH] stabler fragment transactions --- .../myplanet/ui/sync/DashboardElementActivity.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/org/ole/planet/myplanet/ui/sync/DashboardElementActivity.kt b/app/src/main/java/org/ole/planet/myplanet/ui/sync/DashboardElementActivity.kt index 2175782370..8a4941627d 100644 --- a/app/src/main/java/org/ole/planet/myplanet/ui/sync/DashboardElementActivity.kt +++ b/app/src/main/java/org/ole/planet/myplanet/ui/sync/DashboardElementActivity.kt @@ -66,10 +66,12 @@ abstract class DashboardElementActivity : SyncActivity(), FragmentManager.OnBack } fun openCallFragment(newfragment: Fragment, tag: String?) { - supportFragmentManager.beginTransaction() - .replace(R.id.fragment_container, newfragment, tag) - .addToBackStack(null) - .commitAllowingStateLoss() + if (!isDestroyed && !isFinishing) { + supportFragmentManager.beginTransaction() + .replace(R.id.fragment_container, newfragment, tag) + .addToBackStack(null) + .commitAllowingStateLoss() + } } override fun onPrepareOptionsMenu(menu: Menu): Boolean {