As explained on the official GitHub page, adding validators via attributes is easy:
@NotEmpty
@Email
private EditText email;
Now that the EditText has been verified that it is not empty and that it contains email. But now, how can I add these two identical conditions from the code? Looking through the code, there seems to be this method:
public <VIEW extends View> void put(final VIEW view, final QuickRule<VIEW>... quickRules)
And I tried using it like:
mValidator.put(txtDestinationAddr, new NotEmptyRule(), new EmailRule());
But it seems that the constructors for all the rules are protected and cannot be used in this way.
source
share