从联系人数量格式化 [英] Formating of number from contacts
问题描述
我为Android编写一些短信应用程序,我有一个问题。我发送短信从一个仿真程序到另一个。这SMS具有15555215556的电话号码,它是从发送。当我的号码保存到联系人,它保存在+ 1-555-521-5556的格式。接下来,当我的应用程序搜索电话簿找到匹配的电话号码,它找不到任何,因为15555215556是不一样的+ 1-555-521-5556(电话簿)。
有没有办法,可以适当格式给出电话号码,任何内置类? P>
有电话号码的Util类
http://developer.android.com/reference/android/telephony/ PhoneNumberUtils.html
否则,可以使用libphoneumber
的http://$c$c.google.com/p/libphonenumber/
只有140 KB
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
http://developer.android.com/reference/android/telephony/PhoneNumberUtils.html
otherwise you can use libphoneumber
http://code.google.com/p/libphonenumber/
only 140 KB
这篇关于从联系人数量格式化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!