5

Is there a nice way to delete all SharedPreferences (= all data from all key to value maps, not just all values from a single map) of my application programmatically on Android? There were similar questions here, but I really want to delete all, not just "OneOfMany", so

SharedPreferences settings = context.getSharedPreferences("OneOfMany", Context.MODE_PRIVATE);
settings.edit().clear().commit();

is not good solution.

And programmatically means that Application manager/My app/Clear data is also not good solution. Any idea?

braX
  • 11,506
  • 5
  • 20
  • 33
Jan Němec
  • 309
  • 6
  • 14
  • 1
    My question is no duplicate of "Deleting shared preferences", or at least trere is no reply to it. There (and also here now) are just replys how to delete (one or more) values from a single SharedPreferences key to value map. – Jan Němec Dec 05 '14 at 11:35

1 Answers1

0
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
            Editor editor = prefs.edit();
            editor.clear();
            editor.commit();
Don Chakkappan
  • 7,397
  • 5
  • 44
  • 59