Register the listener for switch during onResume
- Fix b/16118646 Change-Id: I9ec87422ecc4e05ca332e116af71c07f06c6c65a
This commit is contained in:
@@ -73,7 +73,6 @@ public class LocationSettings extends LocationSettingsBase
|
|||||||
|
|
||||||
mSwitchBar = activity.getSwitchBar();
|
mSwitchBar = activity.getSwitchBar();
|
||||||
mSwitch = mSwitchBar.getSwitch();
|
mSwitch = mSwitchBar.getSwitch();
|
||||||
mSwitchBar.addOnSwitchChangeListener(this);
|
|
||||||
mSwitchBar.show();
|
mSwitchBar.show();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,7 +80,6 @@ public class LocationSettings extends LocationSettingsBase
|
|||||||
public void onDestroyView() {
|
public void onDestroyView() {
|
||||||
super.onDestroyView();
|
super.onDestroyView();
|
||||||
|
|
||||||
mSwitchBar.removeOnSwitchChangeListener(this);
|
|
||||||
mSwitchBar.hide();
|
mSwitchBar.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -94,6 +92,7 @@ public class LocationSettings extends LocationSettingsBase
|
|||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
createPreferenceHierarchy();
|
createPreferenceHierarchy();
|
||||||
|
mSwitchBar.addOnSwitchChangeListener(this);
|
||||||
mValidListener = true;
|
mValidListener = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -105,6 +104,7 @@ public class LocationSettings extends LocationSettingsBase
|
|||||||
// Ignore exceptions caused by race condition
|
// Ignore exceptions caused by race condition
|
||||||
}
|
}
|
||||||
super.onPause();
|
super.onPause();
|
||||||
|
mSwitchBar.removeOnSwitchChangeListener(this);
|
||||||
mValidListener = false;
|
mValidListener = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user