Featured post

Marshmallow Features Point by Point

Android Runtime (“ART”) Improved application performance and lower memory overhead for faster  multi-tasking. Battery Doze...

Friday 17 August 2012

Email validation

1. 
 public static boolean isEmailValid(String email)
 { 
       boolean isValid = false; 
       String expression = "^[\\w\\.-]+@([\\w\\-]+\\.)+[A-Z]{2,4}$"; 
       CharSequence inputStr = email; 
       Pattern pattern = Pattern.compile(expression, Pattern.CASE_INSENSITIVE); 
       Matcher matcher = pattern.matcher(inputStr); 
       
       if (matcher.matches())
       { 
          isValid = true; 
       } 
       return isValid; 
  } 
==========================================
2.
 public boolean checkEmailCorrect(String Email) 
{
String pttn ="[a-zA-Z0-9._-]+@[a-z]+\\.+[a-z]+";
Pattern p = Pattern.compile(pttn);
Matcher m = p.matcher(Email);

if(m.matches())
{
return true;
}
return false;
}
=============================================
3.
http://www.coderzheaven.com/2011/05/01/email-validation-in-android/

No comments:

Post a Comment