I'm trying to force PreferenceActivity
to refresh. Does anyone know how to do this?
I have a ResetDefaultsPreference
class that subclasses Preference
and, when clicked, is supposed to reset to defaults all preferences whose keys start with a certain prefix. It works, but when I hit the reset preference, none of the preferences in that screen update until I back out of the screen and go back in. (That works for some custom color preferences, but even that doesn't work for some ListPreference
s - for those I have to leave and re-enter the PreferenceActivity
itself for the updated values to be shown.)
I tried to fix this by getting the root view and invalidate()
ing it, but that doesn't seem to work. Here's the line to refresh the display. It's in part of a Preference
subclass that keeps the Context
it was created with in mContext
.
((Activity)mContext).findViewById(android.R.id.content).invalidate();
This happens after the preference values have been changed and committed. (The values change, but the display doesn't.) Does anyone know how I can force PreferenceActivity to refresh itself?