业务流程图:
开发步骤:
- 获取用户输入的账号和密码
- 使用IF逻辑语句进行业务逻辑判断
- 根据判断的结果给予用户相应的提示
1 //Register_Activity.java 2 3 private boolean checkform() { 4 if (this.txtRegAccount.getText().toString() == null || this.txtRegAccount.getText().toString().length() == 0) { 5 Toast.makeText(getApplicationContext(), "警告:注册账号不能为空", Toast.LENGTH_LONG).show(); 6 return false; 7 } 8 if (this.txtRegPassword.getText().toString() == null || this.txtRegPassword.getText().toString().length() == 0) { 9 Toast.makeText(getApplicationContext(), "警告:注册密码不能为空", Toast.LENGTH_LONG).show(); 10 return false; 11 } 12 if (!(this.txtRegPassword.getText().toString()).equals((this.txtReRegPassword.getText().toString()))) { 13 Toast.makeText(getApplicationContext(), "警告:两次密码不一致", Toast.LENGTH_LONG).show(); 14 return false; 15 } 16 return true; 17 }
运行: