diff options
| -rw-r--r-- | core/java/android/provider/Telephony.java | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/core/java/android/provider/Telephony.java b/core/java/android/provider/Telephony.java index 7a6f6bb5c0a2..0207330259e6 100644 --- a/core/java/android/provider/Telephony.java +++ b/core/java/android/provider/Telephony.java @@ -1264,6 +1264,21 @@ public final class Telephony { } /** + * Returns true if the number is a Phone number + * + * @param number the input number to be tested + * @return true if number is a Phone number + */ + public static boolean isPhoneNumber(String number) { + if (TextUtils.isEmpty(number)) { + return false; + } + + Matcher match = Regex.PHONE_PATTERN.matcher(number); + return match.matches(); + } + + /** * Contains all MMS messages in the MMS app's inbox. */ public static final class Inbox implements BaseMmsColumns { |