SharedPreferences will not save/load in PreferenceActivity

后端 未结 7 2081
星月不相逢
星月不相逢 2020-12-30 05:18

EDIT: The problem described below was due to a very peculiar device issue not caused by any coding-related problem.

I have a preferenceActi

7条回答
  •  说谎
    说谎 (楼主)
    2020-12-30 06:05

    Try clearing the editor before you set your values. I had the same problem and it worked for me. Example:

    Editor e = PreferenceManager.getDefaultSharedPreferences(getParent()).edit();
    e.clear();
    e.putStringSet(key, value);
    

提交回复
热议问题