To check does preferences exist I tried this way, but it shows null every time(maybe because I saved preferences in different view):
String def = null;
String test = getPreferences(MODE_PRIVATE).getString(PREF_GAME,def);
if(test == null) Log.v("main", "no saved data");
To delete preferences I tried editor.clear(), but it does't delete (however commit() every time return true):
SharedPreferences preferences = getSharedPreferences(PREF_GAME,MODE_PRIVATE);
SharedPreferences.Editor editor = preferences.edit();
editor.clear();
boolean tt = editor.commit();Log.v("DELETE PREF", String.valueOf(tt));
UPDATE: I found that if I check preferences exist in the same view, where i saved it, this checking works fine, but how can i do this in different view?
Update: I guessed with myself, thanks everyone!