2022/3/9
switch (v.getId()){ case R.id.btn_login: if(userid.equals("teacher")&&password.equals("11111")) { SharedPreferences.Editor editor = preferences.edit(); editor.putString("userid",userid ); editor.commit(); intent = new Intent(this, TeahcerLoginSuccessActivity.class); // 创建一个新包裹 Bundle bundle = new Bundle(); bundle.putString("login_sid", userid); intent.putExtras(bundle); startActivity(intent); } else{ if(info!=null){ if(info.getPassword().equals(password)){ SharedPreferences.Editor editor = preferences.edit(); editor.putString("userid",userid ); editor.commit(); intent = new Intent(this, LoginSuccessActivity.class); // 创建一个新包裹 Bundle bundle = new Bundle(); bundle.putString("login_sid", userid); intent.putExtras(bundle); startActivity(intent); } } } break; case R.id.btn_register: intent = new Intent(this, RegisterActivity.class); startActivity(intent); break; }
安卓登录界面