Question Detail

How can I check that user is entering right Email ID? Is there any email id Formate checker how can check the pattern of Email ID?


Thread Reply

Anonymous

- 1 years ago

if you don't want to set accurate Email Address Checker you can use this.

private boolean isEmailValid(String email) {
    //TODO: Replace this with your own logic
    return email.contains("@");
}
Correct Answer

Hemant Sharma

- 1 years ago

public final static boolean isvalidEmailID(CharSequence email) {
    if (email == null || email.toString().isEmpty()) {
        return false;
    } else {
        return android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches();
    }
}
Correct Answer

Hemant Sharma

- 1 years ago

public final static boolean isvalidEmailID(CharSequence email) {
    if (email == null || email.toString().isEmpty()) {
        return false;
    } else {
        return android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches();
    }
}