如何在android中对电话号码进行验证,"以+开头"?

tej*_*eja 1 android

 Pattern p = Pattern.compile("^\\+(?:[0-9] ?){6,14}[0-9]$");
          //Match the given string with the pattern
          Matcher m = p.matcher(numberstr);
          //check whether match is found 
          boolean numberFound = m.matches();
Run Code Online (Sandbox Code Playgroud)

Pen*_*m10 8

1)如果要验证文本字段,那么他们只能输入您需要输入XML的电话号码

android:phoneNumber="true"
Run Code Online (Sandbox Code Playgroud)

2)或者,如果您想验证电话号码,请使用Linkify类,并且您可以使用它提供的MatchFilter接口来获取密码序列中的已识别电话号码.