Java tutorial
//package com.java2s; import android.text.TextUtils; import android.widget.EditText; import java.util.regex.Pattern; public class Main { private static final String PHONE_NUMBER_REG = "^((\\+{0,1}86){0,1})1[0-9]{10}"; public static boolean isValidPhoneNumber(EditText paramEditText) { if (paramEditText == null) { throw new NullPointerException("EditText can't null"); } return isValidPhoneNumber(paramEditText.getText().toString()); } public static boolean isValidPhoneNumber(String paramString) { if (TextUtils.isEmpty(paramString)) { return false; } return Pattern.compile(PHONE_NUMBER_REG).matcher(paramString).matches(); } }