I have a listView activity and need to apply and save some preferences made by user. Each row of my ListView contains of two TextViews (year and country).
I handle onSharedPreferenceChanged event this way:
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
prefs.registerOnSharedPreferenceChangeListener(new SharedPreferences.
OnSharedPreferenceChangeListener() {
public void onSharedPreferenceChanged(SharedPreferences prefs,
String key) {
TextView year = (TextView) findViewById(R.id.year);
year.setTextSize(Float.parseFloat(prefs.getString(key, null)));
TextView country = (TextView) findViewById(R.id.country);
country.setTextSize(Float.parseFloat(prefs.getString(key, null)));
}
});
But the changes are applied only for the first row, the others stay the same as before.
What should I do to apply new settings for each row of the list? Thanks for your answers.