I want to change the values displayed in each Preferencein my PreferenceActivitybased on a change in another preference.
I have an application that stores metric (float) values in Preferences. I also have Preference, called metric, where the user can switch between using metric or imperial units.
I save only metric values, but when the user switches to imperial, the application displays imperial values.
Everything works fine if the user only switches the metric preference and leaves PreferenceActivity. When he returns, the values are displayed correctly. If he looks at userHeight, for example, the display still shows a metric value.
In mine, PreferenceActivityI want to update the displayed values when the metricPreference changes (I'm sure that when these values are saved, they will be returned correctly):
this.metric.setOnPreferenceChangeListener (new OnPreferenceChangeListener () {
@Override
public boolean onPreferenceChange (Preference preference, Object newValue) {
final Boolean metric = Boolean.parseBoolean (newValue.toString ());
changeSummaries (metric);
refreshDisplay (metric);
return true;
}
});
refreshDisplay(...)? , PreferenceActivity ?