diff options
author | Adam Powell <adamp@google.com> | 2010-03-18 14:51:39 -0700 |
---|---|---|
committer | Adam Powell <adamp@google.com> | 2010-03-18 17:08:15 -0700 |
commit | e7fea45863afb10335cb7845aebcf2907d3c3e41 (patch) | |
tree | 2e8877809305091c8acd9637f68bba897860bd73 /core/java/android | |
parent | f298a027ed9a35d46e224ee973401c8b189c7653 (diff) | |
download | frameworks_base-e7fea45863afb10335cb7845aebcf2907d3c3e41.zip frameworks_base-e7fea45863afb10335cb7845aebcf2907d3c3e41.tar.gz frameworks_base-e7fea45863afb10335cb7845aebcf2907d3c3e41.tar.bz2 |
Fix bug 2520540
PreferenceActivity will now persist view hierarchy state properly.
Change-Id: I4e7fe036d0d0bced78e58e2a15808facf502e449
Diffstat (limited to 'core/java/android')
-rw-r--r-- | core/java/android/preference/PreferenceActivity.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/core/java/android/preference/PreferenceActivity.java b/core/java/android/preference/PreferenceActivity.java index 837ce91..726793d 100644 --- a/core/java/android/preference/PreferenceActivity.java +++ b/core/java/android/preference/PreferenceActivity.java @@ -24,7 +24,6 @@ import android.os.Bundle; import android.os.Handler; import android.os.Message; import android.view.View; -import android.view.Window; /** * Shows a hierarchy of {@link Preference} objects as @@ -81,6 +80,8 @@ public abstract class PreferenceActivity extends ListActivity implements private PreferenceManager mPreferenceManager; + private Bundle mSavedInstanceState; + /** * The starting request code given out to preference framework. */ @@ -137,15 +138,19 @@ public abstract class PreferenceActivity extends ListActivity implements @Override protected void onRestoreInstanceState(Bundle state) { - super.onRestoreInstanceState(state); - Bundle container = state.getBundle(PREFERENCES_TAG); if (container != null) { final PreferenceScreen preferenceScreen = getPreferenceScreen(); if (preferenceScreen != null) { preferenceScreen.restoreHierarchyState(container); + mSavedInstanceState = state; + return; } } + + // Only call this if we didn't save the instance state for later. + // If we did save it, it will be restored when we bind the adapter. + super.onRestoreInstanceState(state); } @Override @@ -176,6 +181,10 @@ public abstract class PreferenceActivity extends ListActivity implements final PreferenceScreen preferenceScreen = getPreferenceScreen(); if (preferenceScreen != null) { preferenceScreen.bind(getListView()); + if (mSavedInstanceState != null) { + super.onRestoreInstanceState(mSavedInstanceState); + mSavedInstanceState = null; + } } } |