Check if key exists in Shared Preferences

后端 未结 4 848
情书的邮戳
情书的邮戳 2020-12-13 23:51

I\'m creating Shared Preferences as follows

preferences = getSharedPreferences(\"text\", 0);
final Editor editor = preferences.edit();

String s1 = serverIP.         


        
4条回答
  •  温柔的废话
    2020-12-14 00:28

    Try contains(String key) Accorting to the Javadocs,

    Checks whether the preferences contains a preference. Returns true if the preference exists in the preferences, otherwise false.

提交回复
热议问题