第三天
完善了登陆验证功能
因为是一款社交软件
所以身份验证非常重要,在这部分也花费了不少的时间
部分重要函数:
Button btn_register_ok = findViewById(R.id.btn_register_ok);
btn_register_ok.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
EditText name=findViewById(R.id.et_name);
EditText idnumber=findViewById(R.id.et_idnumber);
String id=getIntent().getStringExtra("id");
if(!name.getText().toString().equals("")&&!idnumber.getText().toString().equals("")
&&(name.getText().toString().length()<=4&&name.getText().toString().length()>=2)&&idnumber.getText().toString().length()==18
&&IDCardValidate.validate_effective(idnumber.getText().toString())){
Bean bean = new Bean();
bean.Name = name.getText().toString();
bean.Idnumber = idnumber.getText().toString();
bean.update(id, new UpdateListener() {
@Override
public void done(BmobException e) {
if (e == null) {
Toast.makeText(Certification.this,"认证成功!",Toast.LENGTH_SHORT).show();
Intent intent = new Intent(Certification.this, Login.class);
startActivity(intent);
finish();
}
}
});
}else {
Toast.makeText(Certification.this,"姓名或身份证号填写错误!",Toast.LENGTH_SHORT).show();
}
}