In my app, preferences are organized by SharedPreferences
. I need to perform reset to application defaults.
I know how to reset all values for particular SharedPreferences
:
SharedPreferences prefs = getSharedPreferences(
"name_of_the_preferences_file",
MODE_PRIVATE
);
SharedPreferences.Editor editor = prefs.edit();
editor.clear();
editor.commit();
But the problem is that only preferences for one particular preferences "name_of_the_preferences_file" is reset. Of course, all the rest preferences are not affected.
So, how to achieve full defauls reset?
It would be good to get names of all the preferences files, to reset it one-by-one.
But ideally, I want programmatically destroy all application data. This could be the best variant.