Меня вдохновляет использование hashCode()
для сравнения двух EditText
:
@Override
public void afterTextChanged(Editable editable) {
if (editable.hashCode() == userNameTextInputLayout.getEditText().getText().hashCode()) {
if (!hasSpecialCharacter(editable.toString())) {
userNameTextInputLayout.setError("At least one special character");
} else {
userNameTextInputLayout.setError(null);
userNameTextInputLayout.setErrorEnabled(false);
}
}
if (editable.hashCode() == passwordTextInputLayout.getEditText().getText().hashCode()) {
if (!hasSpecialCharacter(editable.toString())) {
passwordTextInputLayout.setError("At least one special character");
} else if (!hasNumericCharacter(editable.toString())) {
passwordTextInputLayout.setError("At least one number");
} else {
passwordTextInputLayout.setError(null);
passwordTextInputLayout.setErrorEnabled(false);
}
}
}
Но возможно ли получить объект View
(например, EditText
здесь) через * 1008? *? Если так, то как?