Unfortunately, there isn't a clean way to force the preference activity to
refresh values.
This hack is probably as good as any for 1.0.
jason
On Thu, Oct 2, 2008 at 10:41 AM, Ludwig <[EMAIL PROTECTED]> wrote:
> I have an ugly solution to this.There should be somewhere to force it to
> reload the preferences and refresh the screen, but just like you I do not
> know how to do it. (Suggestions?)
>
> However, what you can do is to finish the current preferences activity and
> to restart it in a new activity, like so:
>
> protected void resetPreferences(){
> prefs = getSharedPreferences("...", Context.MODE_PRIVATE);
> SharedPreferences.Editor editor = prefs.edit();
> ... // do all the resetting
> editor.commit();
> finish();
> ComponentName comp = new ComponentName(this.getPackageName(),
> getClass().getName());
> startActivity(new Intent().setComponent(comp));
> }
>
> This at least works if you are on the main screen of the activity.
>
> Yes, it is a hack.
>
> Ludwig
> 2008/10/2 Amos <[EMAIL PROTECTED]>
>
>
>> I have a PreferenceActivity inflated from xml. One of the preferences
>> launches an intent which opens an activity that clears all the
>> preferences and resets them to the default values.
>>
>> My problem is that when this "restore defaults" activity returns, and
>> I navigate to another preference screen with, say, a checkbox
>> preference, the previous preference values still appear on the screen.
>> If I exit the preference activity and then reopen it, the updated
>> preference values appear.
>>
>> This seems like a refresh issue. Is there a way I can tell the
>> PreferenceActivity to refresh its values? (I made sure I am comitting
>> all my preference changes)
>>
>> Thanks
>>
>>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---