From cff4c8bef4c15d7959594fc7d7eb80a8d0bc3e10 Mon Sep 17 00:00:00 2001 From: "Vishnu Sanal. T" Date: Mon, 6 Sep 2021 10:46:12 +0530 Subject: [PATCH 1/2] Fixes #1555 --- .../com/amaze/filemanager/ui/fragments/TabFragment.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/com/amaze/filemanager/ui/fragments/TabFragment.java b/app/src/main/java/com/amaze/filemanager/ui/fragments/TabFragment.java index 3b324b1596..fb8c5ba613 100644 --- a/app/src/main/java/com/amaze/filemanager/ui/fragments/TabFragment.java +++ b/app/src/main/java/com/amaze/filemanager/ui/fragments/TabFragment.java @@ -240,7 +240,11 @@ public void onSaveInstanceState(Bundle outState) { if (fragments != null && fragments.size() != 0) { if (fragmentManager == null) return; for (Fragment fragment : fragments) { - fragmentManager.putFragment(outState, "tab" + i, fragment); + + if (fragment.isAdded()) { + fragmentManager.putFragment(outState, "tab" + i, fragment); + } + i++; } outState.putInt(KEY_POSITION, mViewPager.getCurrentItem()); From 1245b5b0c337cd0c375a31432524ecc1df949419 Mon Sep 17 00:00:00 2001 From: Vishal Nehra Date: Sat, 11 Sep 2021 01:29:49 +0530 Subject: [PATCH 2/2] 1555: Execute pending transactions before setting fragments in instancestate --- .../com/amaze/filemanager/ui/fragments/TabFragment.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/amaze/filemanager/ui/fragments/TabFragment.java b/app/src/main/java/com/amaze/filemanager/ui/fragments/TabFragment.java index fb8c5ba613..b588a5b9be 100644 --- a/app/src/main/java/com/amaze/filemanager/ui/fragments/TabFragment.java +++ b/app/src/main/java/com/amaze/filemanager/ui/fragments/TabFragment.java @@ -239,12 +239,9 @@ public void onSaveInstanceState(Bundle outState) { if (fragments != null && fragments.size() != 0) { if (fragmentManager == null) return; + fragmentManager.executePendingTransactions(); for (Fragment fragment : fragments) { - - if (fragment.isAdded()) { - fragmentManager.putFragment(outState, "tab" + i, fragment); - } - + fragmentManager.putFragment(outState, "tab" + i, fragment); i++; } outState.putInt(KEY_POSITION, mViewPager.getCurrentItem());