I would like to refresh the ui views when changing the preferences. If
there an elegant way of notifying the views that the preferences has
changed?
I have a custom preference that will reset settings to the default
values. The default values are specified per preference in a
preference.xml.
Reset the preferences is easy:
SharedPreferences prefs = PreferenceManager
.getDefaultSharedPreferences(getBaseContext());
prefs.edit().clear().commit();
PreferenceManager.setDefaultValues(getBaseContext(), R.xml.settings,
true);
But I would also be able to re-initialize (re-bind) the ui to reflect
the values of the preferences. This is automatically done when
PreferenceActivity is created.
As a work-around I'm starting a new copy of the PreferenceActivity and
closing down the current one with finish().
startActivity(new Intent(getBaseContext(),
SettingsPreferenceActivity.class));
finish();
This works, but is visually ugly as the ui flickers.
Any suggestions that does not involve getting each and every ui view
with getPreferenceScreen().findPreference("key")?
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en