am 218f99c0: Register the listener for switch during onResume

* commit '218f99c0e56bf43d66690d92a151efcb711d2fcd':
  Register the listener for switch during onResume
This commit is contained in:
Lifu Tang
2014-07-14 23:23:21 +00:00
committed by Android Git Automerger

View File

@@ -73,7 +73,6 @@ public class LocationSettings extends LocationSettingsBase
mSwitchBar = activity.getSwitchBar();
mSwitch = mSwitchBar.getSwitch();
mSwitchBar.addOnSwitchChangeListener(this);
mSwitchBar.show();
}
@@ -81,7 +80,6 @@ public class LocationSettings extends LocationSettingsBase
public void onDestroyView() {
super.onDestroyView();
mSwitchBar.removeOnSwitchChangeListener(this);
mSwitchBar.hide();
}
@@ -94,6 +92,7 @@ public class LocationSettings extends LocationSettingsBase
public void onResume() {
super.onResume();
createPreferenceHierarchy();
mSwitchBar.addOnSwitchChangeListener(this);
mValidListener = true;
}
@@ -105,6 +104,7 @@ public class LocationSettings extends LocationSettingsBase
// Ignore exceptions caused by race condition
}
super.onPause();
mSwitchBar.removeOnSwitchChangeListener(this);
mValidListener = false;
}