Clearing preferences in SharedPreferences in Android, not just Values

后端 未结 2 1537
北恋
北恋 2020-12-16 18:20

from what I can incur out of the SharedPreferences documentation, I can update a preference, add one or clear all preference values in a shared preference file.

But

2条回答
  •  不思量自难忘°
    2020-12-16 18:55

    you could try deleteFile to delete the sharedpreferences file in your app's private storage.

    If you just want to delete the contents but not the file, calling .edit().clear().commit() should do it.

    If just you want to delete one preference, calling .edit().remove("key").commit() should work.

提交回复
热议问题