Code example for SharedPreferences.Editor: Saving app preferences

Methods: commit, remove

0
     public void removeInstapaperCredentials() 
     { 
         try  
         { 
        	//remove username 
			prefsEditor.remove("instapaper_username");
			prefsEditor.commit();
			//remove password 
			prefsEditor.remove("instapaper_password");
			prefsEditor.commit();
		} catch (Exception e) {
			Log.e(TAG, "Unable to remove or commit username/password setting: " + e);
		} 
          
     } 
 
     public void setInstapaperUsername(String text) 
     { 
         try  
         { 
			prefsEditor.putString("instapaper_username", EncryptionUtil.encrypt("username", text));