Extension Methods

This section describes how to use Kotlin extension methods for validation checks.

Overview

EasyValidation utilizes the power of Kotlin Extension methods and provides you huge number of built-in validation rules in form of extensions on String, EditText, TextView, AutoCompleteTextView, TextInputLayout, and Spinner classes.

For example, you can check some validation checks on EditText like this:

var txtEmail = findViewById<EditText>(R.id.txtEmail)

// Valid email check
txtName.validEmail() { msg ->
    // Invalid email
    txtName.error = msg
}

// Minimum length check
txtName.minLength(5) {
    txtName.error = it
}

List of Extension Methods

Here is the list of all extension methods for String, EditText, TextView, AutoCompleteTextView, TextInputLayout, and Spinner classes.

Last updated