How to delete shared preferences data from App in Android

To remove specific values: SharedPreferences.Editor.remove() followed by a commit()

To remove them all SharedPreferences.Editor.clear() followed by a commit()

If you don't care about the return value and you're using this from your application's main thread, consider using apply() instead.


My solution:

SharedPreferences preferences = getSharedPreferences("Mypref", 0);
preferences.edit().remove("text").commit();

Removing all preferences:

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

Removing single preference:

SharedPreferences settings = context.getSharedPreferences("PreferencesName", Context.MODE_PRIVATE);
settings.edit().remove("KeyName").commit();

If it's not necessary to be removed every time, you can remove it manually from:

Settings -> Applications -> Manage applications -> (choose your app) -> Clear data or Uninstall

Newer versions of Android:

Settings -> Applications -> (choose your app) -> Storage -> Clear data and Clear cache