title: How to validate Email Id in android?
body: <p>I had implemented email validation in my app but problem is that app was accepting local domain part of more than 64 character and when I write ..nnn..@gmail.com app was accepting this also and also As per the RFC 3696 specification #section 3, period (".") may not be used to start or end the local part, nor may two or more consecutive periods appear. </p>
  
  <p>Please help me out</p>
  
  <pre><code>private boolean isValidEmail(String email) {// validation for email Id
      boolean isValid = false;
      String expression = "^[\\w\\.-]+@([\\w\\-]+\\.)+[A-Z]{2,255}$";
  
      Pattern pattern = Pattern.compile(expression, Pattern.CASE_INSENSITIVE);
      Matcher matcher = pattern.matcher(email);
      if (matcher.matches()) {
          isValid = true;
  
      }
      return isValid;
  }
  </code></pre>