sp = getSharedPreferences(“login”, Context.MODE_PRIVATE);
boolean check = sp.getBoolean("check", false);
if (check) {
String phone1 = sp.getString("phone", "");
String pwd1 = sp.getString("pwd", "");
pwd.setText(pwd1);
name.setText(phone1);
checkBox.setChecked(true);
}
break;
case R.id.login:
String phone1 = name.getText().toString();
String pwd1 = pwd.getText().toString();
SharedPreferences.Editor edit = sp.edit();
edit.putBoolean("check", checkBox.isChecked());
edit.putString("phone", phone1);
edit.putString("pwd", pwd1);
edit.commit();