Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.text.TextUtils;
import android.widget.EditText;
import java.util.regex.Pattern;

public class Main {
    private static final String EMAIL_NUMBER_REG = "^[0-9a-zA-Z][a-z0-9A-Z\\._-]{1,}@[a-z0-9-]{1,}[a-z0-9]\\.[a-z\\.]{1,}[a-z]$";

    public static boolean isValidEmail(EditText paramEditText) {
        if (paramEditText == null) {
            throw new NullPointerException("EditText can't null");
        }
        return isValidEmail(paramEditText.getText().toString());
    }

    public static boolean isValidEmail(String paramString) {
        if (TextUtils.isEmpty(paramString)) {
            return false;
        }
        return Pattern.compile(EMAIL_NUMBER_REG).matcher(paramString).matches();
    }
}