/** * method is used for checking valid email id format. * * @param email * @return boolean true for valid false for invalid */ public static boolean isEmailValid(String email) { boolean isValid = false; String expression = "^[\\w\\.-]+@([\\w\\-]+\\.)+[A-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; }
2015年3月31日 星期二
[Android] how to check edittext's text is email address or not? (轉貼)
reference: http://stackoverflow.com/questions/6119722/how-to-check-edittexts-text-is-email-address-or-not
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言