Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.annotation.TargetApi;

import android.os.Build;

import android.util.Patterns;

import java.util.regex.Pattern;

public class Main {
    /**
     * Validate an email address
     * @param email email to validate
     * @return return true if email address is valid otherwise false
     */
    @TargetApi(Build.VERSION_CODES.FROYO)
    public static boolean validateEmailAsPerAndroid(String email) {
        final Pattern pattern = Patterns.EMAIL_ADDRESS;
        return pattern.matcher(email).matches();
    }
}