Thanks, that is quite a bit more elegant than what I proposed. (Hint to Google: the documentation for the clear() method on the SharedPreferences.Editor says: "Mark in the editor to remove *all* values from the preferences. Once commit is called, the only remaining preferences will be any that you have defined in this editor." That is, IMHO, not exactly the same as saying that everything will be reset to what is defined in the XML file... I would have assumed that by just calling clear() it would result in all queries to the shared preferences settings then returning that they are not set.)
(Apologies, this was first posted on the wrong thread) Ludwig 2008/10/27 Guillaume Perrot <[EMAIL PROTECTED]> > > Few tips I currently use : > If you want to clear all settings easiliy: > getSharedPreferences("...", MODE_PRIVATE).edit().clear().commit(); > This method works well when: > * you don't have invisible settings, or you want them to be cleared > too. > * you have specified default values correctly in the xml file > describing the preferences. > > If you want to restart your activity with a single line of code, with > the same extras as before: > startActivity(getIntent()); //provided you didn't modify the original > intent of course > > On 5 oct, 06:39, Amos <[EMAIL PROTECTED]> wrote: > > I've implemented something similar and will leave it like this for > > now. My "resetpreferences" option is currently not in the main > > activity screen, but I'll move it there so it'll behave reasonably. > > > > Guess this is an example of the limitations of working with a > > framework rather than rolling your own code. I'm still very happy with > > thepreferencesframework, though - it's consistent, works well and > > saves a lot of time and hassle. > > > > Thanks! > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com 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 -~----------~----~----~----~------~----~------~--~---