SharedPreferences value is not updated

后端 未结 5 908
野性不改
野性不改 2020-12-01 18:08

I am trying to update the values of SharedPreferences, here is my code:

edit = PreferenceManager.getDefaultSharedPreferences(this).edit();
e         


        
5条回答
  •  死守一世寂寞
    2020-12-01 18:43

    Try like this,

    public SharedPreferences prefs;
    SharedPreferences.Editor editor = prefs.edit(); 
    editor.putString(Settings.PREF_USERNAME+"", txtuser);
    editor.putString(Settings.PREF_PASSWORD+"", entered_name);
    editor.commit();    
    

提交回复
热议问题