该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
登录界面源码:
LoginActivity.java
public class LoginActivity extends Activity {
private EditText userName, password;
private CheckBox rem_pw, auto_login;
private Button btn_login;
private ImageButton btnQuit;
private String userNameValue,passwordValue;
private SharedPreferences sp;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//去除标题
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.login);
//获得实例对象
sp = this.getSharedPreferences("userInfo", Context.MODE_WORLD_READABLE);
userName = (EditText) findViewById(R.id.et_zh);
password = (EditText) findViewById(R.id.et_mima);
rem_pw = (CheckBox) findViewById(R.id.cb_mima);
auto_login = (CheckBox) findViewById(R.id.cb_auto);
btn_login = (Button) findViewById(R.id.btn_login);
btnQuit = (ImageButton)findViewById(R.id.img_btn);
//判断记住密码多选框的状态
if(sp.getBoolean("ISCHECK", false))
{
//设置默认是记录密码状态
rem_pw.setChecked(true);
userName.setText(sp.getString("USER_NAME", ""));
password.setText(sp.getString("PASSWORD", ""));
//判断自动登陆多选框状态
if(sp.getBoolean("AUTO_ISCHECK", false))
{
//设置默认是自动登录状态
auto_login.setChecked(true);
//跳转界面
Intent intent = new Intent(LoginActivity.this,LogoActivity.class);
LoginActivity.this.startActivity(intent);
}
}