summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/print
diff options
context:
space:
mode:
authorFabrice Di Meglio <fdimeglio@google.com>2014-05-20 12:26:16 -0700
committerFabrice Di Meglio <fdimeglio@google.com>2014-05-20 12:26:16 -0700
commit38f2b27c0dc49c423b29e4c0cb241c03bfd0b637 (patch)
tree5a7c7548a4b2a48ec219ff32dcc800fd6ad75cad /src/com/android/settings/print
parente9f007e8df22c936434cc8b3678bacd479ca1127 (diff)
downloadpackages_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/android/settings/print')
-rw-r--r--src/com/android/settings/print/PrintServiceSettingsFragment.java13
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();
}