What is the use of TelephoneNumberUtil class?
Asked Answered
S

3

8

I want to know the basic use of TelephoneNumberUtil class in Android. I searched on that but in the Android I'm not able to get a proper answer. Can anyone explain me the exact use of this class?

Sculpin answered 26/7, 2011 at 6:28 Comment(1)
There's no class TelephoneNumberUtil in Android SDK.Confraternity
L
13

It is a formatter for international phone numbers.

Literator answered 28/7, 2011 at 6:28 Comment(2)
Link in answer is dead - "Status Code:404 Not Found".Straighten
Here's a cached page copy from Internet Archive. It says that TelephoneNumberUtil class was removed in SDK v0.9.Confraternity
Z
3

According to the documentation public class PhoneNumberUtils contains

various utilities for dealing with phone number strings

Zins answered 26/7, 2011 at 7:19 Comment(0)
F
0

Simple answer

Format an international telephone number.

Detailed Answer

if you have number 1234567890 and you need format it US number format to be like this

123-456-7890

then you should use formatNumber method

PhoneNumberUtils.formatNumbe(yourPhoneString); 

Notice this method deprecated use instead formatNumber (String phoneNumber, String defaultCountryIso)

Reference

https://developer.android.com/reference/android/telephony/PhoneNumberUtils.html

Fictional answered 13/2, 2017 at 13:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.