1.保存操作
/**
* 保存用户第一次登录的用户名以及密码
*
* @param userName
* 用户名
* @param passWord
* 密码
*/
public static void saveFristPreferences(String userName, String passWord,
boolean ischeck) {
SharedPreferences preferencr = IMSDroid.getContext()
.getSharedPreferences(fristLogin, 0);
SharedPreferences.Editor editor = preferencr.edit();
editor.putBoolean(loginFlag, false);
editor.putString(loginName, userName);
editor.putString(loginPassWord, passWord);
editor.putBoolean(isAutoLogin, ischeck);
editor.commit();
}
2.读取操作
/**
* 判断是否自动登录
*/
public static boolean isAutoLogin() {
SharedPreferences fer = IMSDroid.getContext().getSharedPreferences(
fristLogin, 0);
isAutoValue = fer.getBoolean(isAutoLogin, false);
// Log.e(debug, "isauto ==" + isAutoValue);
return isAutoValue;
}
本博客详细介绍了如何在应用中保存和读取用户的第一次登录信息,包括用户名、密码以及自动登录设置。
807

被折叠的 条评论
为什么被折叠?



