diff options
author | Dianne Hackborn <hackbod@google.com> | 2012-06-20 12:10:36 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-06-20 12:10:36 -0700 |
commit | ae5bd3a998fb0b811f2575899514e73243041a5d (patch) | |
tree | 97c0ef4647fd926b8cc2bb949a20df597cbecb56 | |
parent | 74cc83fe77e80b1954ba0dba75e2827cb9e0dfa2 (diff) | |
parent | cb1c45ed80df368051368a478fa931d3333c99f6 (diff) | |
download | frameworks_base-ae5bd3a998fb0b811f2575899514e73243041a5d.zip frameworks_base-ae5bd3a998fb0b811f2575899514e73243041a5d.tar.gz frameworks_base-ae5bd3a998fb0b811f2575899514e73243041a5d.tar.bz2 |
am cb1c45ed: am b6ce1f31: Merge "Fix issue #6675499: java.lang.RuntimeException: Unable to start..." into jb-dev
* commit 'cb1c45ed80df368051368a478fa931d3333c99f6':
Fix issue #6675499: java.lang.RuntimeException: Unable to start...
-rw-r--r-- | core/java/android/app/FragmentManager.java | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/core/java/android/app/FragmentManager.java b/core/java/android/app/FragmentManager.java index d8777fb..b0cc37b 100644 --- a/core/java/android/app/FragmentManager.java +++ b/core/java/android/app/FragmentManager.java @@ -1118,7 +1118,9 @@ final class FragmentManagerImpl extends FragmentManager { if (DEBUG) Log.v(TAG, "remove: " + fragment + " nesting=" + fragment.mBackStackNesting); final boolean inactive = !fragment.isInBackStack(); if (!fragment.mDetached || inactive) { - mAdded.remove(fragment); + if (mAdded != null) { + mAdded.remove(fragment); + } if (fragment.mHasMenu && fragment.mMenuVisible) { mNeedMenuInvalidate = true; } @@ -1187,7 +1189,9 @@ final class FragmentManagerImpl extends FragmentManager { fragment.mDetached = true; if (fragment.mAdded) { // We are not already in back stack, so need to remove the fragment. - mAdded.remove(fragment); + if (mAdded != null) { + mAdded.remove(fragment); + } if (fragment.mHasMenu && fragment.mMenuVisible) { mNeedMenuInvalidate = true; } @@ -1202,6 +1206,9 @@ final class FragmentManagerImpl extends FragmentManager { if (fragment.mDetached) { fragment.mDetached = false; if (!fragment.mAdded) { + if (mAdded == null) { + mAdded = new ArrayList<Fragment>(); + } mAdded.add(fragment); fragment.mAdded = true; if (fragment.mHasMenu && fragment.mMenuVisible) { @@ -1213,7 +1220,7 @@ final class FragmentManagerImpl extends FragmentManager { } public Fragment findFragmentById(int id) { - if (mActive != null) { + if (mAdded != null) { // First look through added fragments. for (int i=mAdded.size()-1; i>=0; i--) { Fragment f = mAdded.get(i); @@ -1221,6 +1228,8 @@ final class FragmentManagerImpl extends FragmentManager { return f; } } + } + if (mActive != null) { // Now for any known fragment. for (int i=mActive.size()-1; i>=0; i--) { Fragment f = mActive.get(i); @@ -1233,7 +1242,7 @@ final class FragmentManagerImpl extends FragmentManager { } public Fragment findFragmentByTag(String tag) { - if (mActive != null && tag != null) { + if (mAdded != null && tag != null) { // First look through added fragments. for (int i=mAdded.size()-1; i>=0; i--) { Fragment f = mAdded.get(i); @@ -1241,6 +1250,8 @@ final class FragmentManagerImpl extends FragmentManager { return f; } } + } + if (mActive != null && tag != null) { // Now for any known fragment. for (int i=mActive.size()-1; i>=0; i--) { Fragment f = mActive.get(i); @@ -1817,7 +1828,7 @@ final class FragmentManagerImpl extends FragmentManager { } public void dispatchConfigurationChanged(Configuration newConfig) { - if (mActive != null) { + if (mAdded != null) { for (int i=0; i<mAdded.size(); i++) { Fragment f = mAdded.get(i); if (f != null) { @@ -1828,7 +1839,7 @@ final class FragmentManagerImpl extends FragmentManager { } public void dispatchLowMemory() { - if (mActive != null) { + if (mAdded != null) { for (int i=0; i<mAdded.size(); i++) { Fragment f = mAdded.get(i); if (f != null) { @@ -1839,7 +1850,7 @@ final class FragmentManagerImpl extends FragmentManager { } public void dispatchTrimMemory(int level) { - if (mActive != null) { + if (mAdded != null) { for (int i=0; i<mAdded.size(); i++) { Fragment f = mAdded.get(i); if (f != null) { @@ -1852,7 +1863,7 @@ final class FragmentManagerImpl extends FragmentManager { public boolean dispatchCreateOptionsMenu(Menu menu, MenuInflater inflater) { boolean show = false; ArrayList<Fragment> newMenus = null; - if (mActive != null) { + if (mAdded != null) { for (int i=0; i<mAdded.size(); i++) { Fragment f = mAdded.get(i); if (f != null && !f.mHidden && f.mHasMenu && f.mMenuVisible) { @@ -1882,7 +1893,7 @@ final class FragmentManagerImpl extends FragmentManager { public boolean dispatchPrepareOptionsMenu(Menu menu) { boolean show = false; - if (mActive != null) { + if (mAdded != null) { for (int i=0; i<mAdded.size(); i++) { Fragment f = mAdded.get(i); if (f != null && !f.mHidden && f.mHasMenu && f.mMenuVisible) { @@ -1895,7 +1906,7 @@ final class FragmentManagerImpl extends FragmentManager { } public boolean dispatchOptionsItemSelected(MenuItem item) { - if (mActive != null) { + if (mAdded != null) { for (int i=0; i<mAdded.size(); i++) { Fragment f = mAdded.get(i); if (f != null && !f.mHidden && f.mHasMenu && f.mMenuVisible) { @@ -1909,7 +1920,7 @@ final class FragmentManagerImpl extends FragmentManager { } public boolean dispatchContextItemSelected(MenuItem item) { - if (mActive != null) { + if (mAdded != null) { for (int i=0; i<mAdded.size(); i++) { Fragment f = mAdded.get(i); if (f != null && !f.mHidden) { @@ -1923,7 +1934,7 @@ final class FragmentManagerImpl extends FragmentManager { } public void dispatchOptionsMenuClosed(Menu menu) { - if (mActive != null) { + if (mAdded != null) { for (int i=0; i<mAdded.size(); i++) { Fragment f = mAdded.get(i); if (f != null && !f.mHidden && f.mHasMenu && f.mMenuVisible) { |