implementation 'org.xutils:xutils:3.5.0'
private boolean isPhoneNumber(String phoneStr) {
//定义电话格式的正则表达式
String regex = "^((13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$";
//设定查看模式
Pattern p = Pattern.compile(regex);
//判断Str是否匹配,返回匹配结果
Matcher m = p.matcher(phoneStr);
return m.find();
}
if (!b) {
Toast.makeText(Main2Activity.this, "手机号不合法", Toast.LENGTH_SHORT).show();
}