What\'s a good technique for validating an e-mail address (e.g. from a user input field) in Android? org.apache.commons.validator.routines.EmailValidator doesn\'t seem to be
If you are using API 8 or above, you can use the readily available Patterns
class to validate email. Sample code:
public final static boolean isValidEmail(CharSequence target) {
if (target == null)
return false;
return android.util.Patterns.EMAIL_ADDRESS.matcher(target).matches();
}
By chance if you are even supporting API level less than 8, then you can simply copy the Patterns.java
file into your project and reference it. You can get the source code for Patterns.java
from this link