deleting sharedPreferences in android
I want to delete the various information i have stored as shared preferences. I know i can do开发者_如何学C it using remove(), but i m not getting where actually i should use it.
Can anyone tell me where actually i should remove() or clear() with a small code snippet...?
I used the following code to save data.
Editor editor = settings.edit();
editor.putString(PREFERENCES_PASS,pwd);
editor.commit();
here, pwd is a String that i extracted from EditText.
You can put it anywhere between your calls to obtain the editor, and calling commit().. So with your code example, you'd put it...
Editor editor = settings.edit();
editor.remove(PREFERENCES_PASS);
editor.commit();
See this doc
Editor editor = settings.edit();
editor.remove(PREFERENCES_PASS);
editor.commit();
精彩评论