form-validator
alexfu
28
Visit GitHub Repo
Validation

form-validator

A simple, easy to use, no frills, form validator for Android.

Usage

EmailRule emailRule = new EmailRule("Invalid email address.");

Validator validator = new Validator();
validate.setCallback(this);
validator.addRule(myEditText, emailRule); // Add rules to your EditText
validator.validate();

If you want to have multiple rules...

EmailRule emailRule = new EmailRule("Invalid email address.");
MinLengthRule minLengthRule = new MinLengthRule(5, "Must be at least 5 characters long.")

Validator validator = new Validator();
validate.setCallback(this);
validator.addRule(myEditText, emailRule, minLengthRule); // Add rules to your EditText
validator.validate();

Adding rules will also bind a TextWatcher to the given EditText and validate it on the fly.

Installation

allprojects {
  repositories {
    maven { url 'https://jitpack.io' }
  }
}

dependencies {
  compile 'com.github.alexfu:form-validator:2.0'
}

Rx

Fancy an Rx API? Take a look at form-validator-rx.

Become Pro in Android by watching videos

OUR LEARNERS WORK AT