SharedPreferences sp;
sp = getSharedPreferences("userInfo", Context.MODE_PRIVATE);
//放值
Editor editor = sp.edit();
editor.putBoolean("isrem", true);
editor.putBoolean("isauto", true);
editor.putString("username", username_et.getText().toString());
editor.putString("password", password_et.getText().toString());
editor.commit();
//取值
sp.getBoolean("isrem", false);
username_et.setText(sp.getString("username", ""));
password_et.setText(sp.getString("password", ""));
Android 记住密码和自动登录
最新推荐文章于 2021-06-04 14:51:43 发布