How to validate an email address in Android

String email = "me@email.com";
if ( android.util.Patterns.EMAIL_ADDRESS.matcher(email).matches() ) {
// VALID EMAIL
}

Do you like to read about Grails / Geb / Groovy development? If the answer is yes, subscribe to Groovy Calamari. A weekly curated email newsletter about the Groovy ecosystem. Curated by me 🎉

2 thoughts on “How to validate an email address in Android

  1. Thomas

    Does this handle valid IDN emails (i. e. where the domain part contains domain specific unicode chars like umlauts in German or glyphs in Chinese)?

    Reply

Leave a Reply to ccc Cancel reply

Your email address will not be published. Required fields are marked *