diff options
author | Fabrice Di Meglio <fdimeglio@google.com> | 2014-05-20 12:26:16 -0700 |
---|---|---|
committer | Fabrice Di Meglio <fdimeglio@google.com> | 2014-05-20 12:26:16 -0700 |
commit | 38f2b27c0dc49c423b29e4c0cb241c03bfd0b637 (patch) | |
tree | 5a7c7548a4b2a48ec219ff32dcc800fd6ad75cad /src/com | |
parent | e9f007e8df22c936434cc8b3678bacd479ca1127 (diff) | |
download | packages_apps_Settings-38f2b27c0dc49c423b29e4c0cb241c03bfd0b637.tar.gz packages_apps_Settings-38f2b27c0dc49c423b29e4c0cb241c03bfd0b637.tar.bz2 packages_apps_Settings-38f2b27c0dc49c423b29e4c0cb241c03bfd0b637.zip |
Fix bug #15109661 Settings crash after tap on back key from print settings
- use onResume() / onPause() for adding / removing the SwitchChangeListener
Change-Id: Ia3a4ff57075d2668e446df4f4f09e4593cc34761
Diffstat (limited to 'src/com')
-rw-r--r-- | src/com/android/settings/print/PrintServiceSettingsFragment.java | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/src/com/android/settings/print/PrintServiceSettingsFragment.java b/src/com/android/settings/print/PrintServiceSettingsFragment.java index 3e1dd0f5d..f104a06d8 100644 --- a/src/com/android/settings/print/PrintServiceSettingsFragment.java +++ b/src/com/android/settings/print/PrintServiceSettingsFragment.java @@ -143,12 +143,16 @@ public class PrintServiceSettingsFragment extends SettingsPreferenceFragment mSettingsContentObserver.register(getContentResolver()); updateEmptyView(); updateUiForServiceState(); + mSwitchBar.addOnSwitchChangeListener(this); + mSwitchBar.show(); } @Override public void onPause() { mSettingsContentObserver.unregister(getContentResolver()); super.onPause(); + mSwitchBar.removeOnSwitchChangeListener(this); + mSwitchBar.hide(); } @Override @@ -159,19 +163,10 @@ public class PrintServiceSettingsFragment extends SettingsPreferenceFragment } @Override - public void onStart() { - super.onStart(); - mSwitchBar.addOnSwitchChangeListener(this); - mSwitchBar.show(); - } - - @Override public void onDestroyView() { if (mOldActivityTitle != null) { getActivity().getActionBar().setTitle(mOldActivityTitle); } - mSwitchBar.removeOnSwitchChangeListener(this); - mSwitchBar.hide(); super.onDestroyView(); } |