Formatting of number from contacts

I’m writing some sms application for android and i have a problem. I send sms from one emulator to another. That sms has “15555215556” as phone number it was sent from. When i save that number to contacts, it’s saved in “+1-555-521-5556” format. Next, when my app search phone book to find matching phone number, it couldn’t find any, because “15555215556” is not the same as “+1-555-521-5556” (in phone book).

Is there any built-in class that can properly format given phone number?


There is the phone number util class

otherwise you can use libphoneumber

only 140 KB