title: How can i validate email in android?
body: <blockquote>
    <p>What's wrong with my email validation??</p>
  </blockquote>
  
  <pre><code>TextInputLayout useremail_layout = (TextInputLayout) findViewById(R.id.email_layout);
  String email = "";
  String emailPattern = "[a-zA-Z0-9._-]+@[a-z]+\\.+[a-z]+";
  if (email.matches(emailPattern)&amp;&amp; email.length()&gt;0) {
      useremail_layout.setError("valid address");
  } else  {
       useremail_layout.setError("invalid email");
       Email.setError(null);  
  }
  </code></pre>