Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Validation without annotations #40

Open
adammo1990 opened this issue Feb 29, 2016 · 1 comment
Open

Validation without annotations #40

adammo1990 opened this issue Feb 29, 2016 · 1 comment

Comments

@adammo1990
Copy link

I would like to use your validation library in my own library, but in library I can't use annotations in library.
Is there a way to add fields for validation without annotations (somehow in code)?

@douglasjunior
Copy link
Contributor

Annotations is the great advantage of this library.

Without annotations you can do the validation and set the error manually.

public static boolean validateEmpty(EditText editText, String errorMessage){
    if (editText.getText().isEmpty()){
        editText.setError(errorMessage);
        return false;
    }
    return true;
}

Using:

    boolean isValid = Util.validateEmpty(editText, "This field is required.")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants