android email pattern check code example
Example 1: android is valid email
import android.util.Patterns
val email: String = "[email protected]"
private fun String.isValidEmail(): Boolean {
return Patterns.EMAIL_ADDRESS.matcher(this).matches()
}
email.isValidEmail()
Example 2: email valid android
public static boolean isValidEmail(CharSequence target) {
return (!TextUtils.isEmpty(target) && Patterns.EMAIL_ADDRESS.matcher(target).matches());
}