title: How to check that entered text is an email address? Android
body: <p>Here is my code. Now I want to check this in if condition:</p>
  
  <pre><code>public static boolean isEmailValid(String email) { boolean isValid = false;
  String expression = "^(([\\w-]+\\.)+[\\w-]+|([a-zA-Z]{1}|[\\w-]{2,}))@"
    + "((([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\.([0-1]?"
    + "[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\."
    + "([0-1]?[0-9]{1,2}|25[0-5]|2[0-4][0-9])\\.([0-1]?"
    + "[0-9]{1,2}|25[0-5]|2[0-4][0-9])){1}|"
    + "([a-zA-Z]+[\\w-]+\\.)+[a-zA-Z]{2,4})$";
  CharSequence inputStr = email;
  
  Pattern pattern = Pattern.compile(expression, Pattern.CASE_INSENSITIVE);
  Matcher matcher = pattern.matcher(inputStr);
  if (!matcher.matches()) {
    isValid = true;
  }
  return isValid;
  </code></pre>