Change fragment removal order for fragment replacement.

Before this patch it for loop was accessing mManager.mAdded elements using
an integer index and also removing the fragments from mAdded using
mManager.removeFragment().

Bug: 24693644
Change-Id: I8e32fffa9f65c2795141f61670956740399960e4
This commit is contained in:
Aurimas Liutikas
2016-01-05 15:58:29 -08:00
parent 8190e5dca4
commit 61fa2d466a

View File

@@ -719,7 +719,7 @@ final class BackStackRecord extends FragmentTransaction implements
Fragment f = op.fragment;
int containerId = f.mContainerId;
if (mManager.mAdded != null) {
for (int i = 0; i < mManager.mAdded.size(); i++) {
for (int i = mManager.mAdded.size() - 1; i >= 0; i--) {
Fragment old = mManager.mAdded.get(i);
if (FragmentManagerImpl.DEBUG) {
Log.v(TAG,