Skip to content

Instantly share code, notes, and snippets.

@ohjongin
Created October 1, 2013 07:48
Show Gist options
  • Save ohjongin/6775124 to your computer and use it in GitHub Desktop.
Save ohjongin/6775124 to your computer and use it in GitHub Desktop.
For API level 8 or above : Validation for a cell number in Android http://stackoverflow.com/questions/5958665/validation-for-a-cell-number-in-android
public boolean isPhoneNumber(String number) {
if (number == null || TextUtils.isEmpty(number)) {
return false;
}
// return Pattern.matches(PHONE_NUMBER_PATTERN, number.replace("-", ""));
return android.util.Patterns.PHONE.matcher(number).matches();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment