Articles‎ > ‎Android Articles‎ > ‎

email Validation in Android

posted Jan 25, 2011, 2:37 AM by Thiyagaraaj M   [ updated Feb 1, 2011, 7:21 AM by Thiyagaraaj Mp ]
Example Java Code

Validate Function:

    public boolean eMailValidation(String emailstring)
    {
        Pattern emailPattern = Pattern.compile(".+@.+\\.[a-z]+");
        Matcher emailMatcher = emailPattern.matcher(emailstring);
        return emailMatcher.matches();
    }

Call method:

eMailValidation("hai@hai.com");

if correct returns true;
else return false;



Comments