Source:
public void onStart() { super.onStart(); analytics.trackPageView(Analytics.EDIT_SETTINGS_ACTIVITY); final Preference locationPreference = preferenceFragment.findPreference(LOCATION); Preference latitudePreference = preferenceFragment.findPreference(LATITUDE); final Preference longitudePreference = preferenceFragment.findPreference(LONGITUDE); locationPreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { Log.d(TAG, "Place to be updated to " + newValue); return setLatLongFromPlace(newValue.toString()); } }); latitudePreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { ((EditTextPreference)locationPreference).setText(""); return true; } }); longitudePreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { ((EditTextPreference)locationPreference).setText(""); return true; } }); Preference gyroPreference = preferenceFragment.findPreference( ApplicationConstants.SHARED_PREFERENCE_DISABLE_GYRO); gyroPreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { Log.d(TAG, "Toggling gyro preference " + newValue); enableNonGyroSensorPrefs(((Boolean) newValue)); return true; } }); enableNonGyroSensorPrefs( sharedPreferences.getBoolean(ApplicationConstants.SHARED_PREFERENCE_DISABLE_GYRO, false)); }

Target:
public void onStart() { super.onStart(); analytics.trackPageView(Analytics.EDIT_SETTINGS_ACTIVITY); final Preference locationPreference = preferenceFragment.findPreference(LOCATION); Preference latitudePreference = preferenceFragment.findPreference(LATITUDE); Preference longitudePreference = preferenceFragment.findPreference(LONGITUDE); locationPreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { Log.d(TAG, "Place to be updated to " + newValue); return setLatLongFromPlace(newValue.toString()); } }); latitudePreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { ((EditTextPreference) locationPreference).setText(""); return true; } }); longitudePreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { ((EditTextPreference) locationPreference).setText(""); return true; } }); Preference gyroPreference = preferenceFragment.findPreference( ApplicationConstants.SHARED_PREFERENCE_DISABLE_GYRO); gyroPreference.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { Log.d(TAG, "Toggling gyro preference " + newValue); enableNonGyroSensorPrefs(((Boolean) newValue)); return true; } }); enableNonGyroSensorPrefs( sharedPreferences.getBoolean(ApplicationConstants.SHARED_PREFERENCE_DISABLE_GYRO, false)); }