Created
May 10, 2016 10:51
-
-
Save ishmaelmakitla/1ce3adfddfa7ed7a3b9553cc2c7dcde7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void getUserLogoutConfirmation(Context context, final SharedPreferences sharedPrefs){ | |
new AlertDialog.Builder(context) | |
.setTitle("Loggin out of IshLema App") | |
.setMessage("Loging out will make the system ask you for username and password next time you use it.") | |
.setPositiveButton("Fine, Forget Me", new DialogInterface.OnClickListener() { | |
public void onClick(DialogInterface dialog, int whichButton) { | |
//remove the cached user | |
try{ | |
Editor sharedPrefsEditor = sharedPrefs.edit(); | |
sharedPrefsEditor.remove(USER_SHAREDPREFERENCE_KEY); | |
sharedPrefsEditor.remove(USER_SHAREDPREFERENCE_VALIDITY_KEY); | |
sharedPrefsEditor.commit(); | |
finish(); | |
}catch(Exception e){ | |
Log.e(TAG, "Error While Trying to Remove UserPreference to Forget User", e); | |
} | |
} | |
}).setNegativeButton("No, Remember Me", new DialogInterface.OnClickListener() { | |
public void onClick(DialogInterface dialog, int whichButton) { | |
// Do nothing. | |
finish(); | |
} | |
}).show(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment