What are some good techniques for email validation on Android? http://commons.apache.org/proper/commons-validator/apidocs/org/apache/commons/validator/routines/EmailValidator.html I don't think this will work, but is there any other library or regular expression?
android email-validation
You can use Patterns from Android API 8 or higher.
public final static boolean isValidEmail(CharSequence target) {
if (TextUtils.isEmpty(target)) {
return false;
} } else {
return android.util.Patterns.EMAIL_ADDRESS.matcher(target).matches();
}
}
You can use it like this. Or
public final static boolean isValidEmail(CharSequence target) {
return !TextUtils.isEmpty(target) && android.util.Patterns.EMAIL_ADDRESS.matcher(target).matches();
}
You can use it like this, too.
© 2024 OneMinuteCode. All rights reserved.