Hi guys Here I am going to explain how to validate Mobile number using Regular Expressions
MobileNo = mobileid.getstring();
MobileNo = mobileid.getstring();
if(Helper.isValidMobile(MobileNo)){
Toast.makeText(activity, "Valid", Toast.LENGTH_SHORT).show();
} else {
} else {
Toast.makeText(activity, "Not Valid", Toast.LENGTH_SHORT).show();
}
}
public static boolean isValidMobile(String argEditText) { try { Pattern pattern = Pattern.compile("^[+]?[0-9]{10,13}$"); Matcher matcher = pattern.matcher(argEditText); return matcher.matches(); } catch (Exception e) { if (ConfVars.PRINTEXECEPTOION) { e.printStackTrace(); } return false; } }
No comments:
Post a Comment