除非满足第一个if else,否则如何实现,因为即使密码不匹配,用户仍然会注册。 (我很擅长编程抱歉...)
if(cfmpassword.equals(password)) {
} else {
Toast.makeText(getApplicationContext(),
"Passwords do not match!",Toast.LENGTH_LONG)
.show();
}
然后这将运行。
if (!name.isEmpty() && !email.isEmpty() && !password.isEmpty()) {
registerUser(name, email, password);
} else {
Toast.makeText(getApplicationContext(),
"Please enter your details!", Toast.LENGTH_LONG)
.show();
}
}
});
答案 0 :(得分:-1)
希望它有所帮助。
private boolean validateData() {
if (!etNewPassword.getText().toString()
.equals(etVerifyPassword.getText().toString())) {
Toast.makeText(context, "Verify password is failed",
Toast.LENGTH_SHORT).show();
return false;
}
return true;
}