Code example for SharedPreferences.Editor: Saving app preferences

Methods: commit, remove

0
      public void removeReadItLaterCredentials() 
      { 
          try  
          { 
         	//remove username 
 			prefsEditor.remove("read_it_later_username");
 			prefsEditor.commit();
 			//remove password 
 			prefsEditor.remove("read_it_later_password");
 			prefsEditor.commit();
 		} catch (Exception e) {
 			Log.e(TAG, "Unable to remove or commit Read It Later username/password setting: " + e);
 		} 
           
      } 
 
      public void setReadItLaterUsername(String text) 
      { 
          try  
          { 
 			prefsEditor.putString("read_it_later_username", EncryptionUtil.encrypt("username", text));