libphonenumber

android: how do I format number as phone with parentheses

蹲街弑〆低调 提交于 2019-11-30 12:42:12
I have a number that I need to format as a telephone number. If I do PhoneNumberUtils.formatNumber(numStr); Then I get 888-555-1234 But what I need to get is (888) 555-1234 How do I get the second one? Is there a standard android way? If you know the country for which you want to do it, you can use Google's open source library libphonenumber . Here is how you can format it: String numberStr = "8885551234" PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance(); try { PhoneNumber numberProto = phoneUtil.parse(numberStr, "US"); //Since you know the country you can format it as follows: System

icu4j is too big, any alternative?

纵饮孤独 提交于 2019-11-29 07:07:41
I am using icu4j in my android code. The jar is about 10MB, which causes my entire application to register an apk of 15MB. Of course the 15MB is likely due to Proguard helping reducing the size. Anyway, does anyone know of a smaller alternative to icu4j? I am using icu4j in conjunction with libphonenumber for one purpose only, which is detailed here , and which I reproduce below: You need: getSupportedRegions() to get the list of region codes getCountryCodeForRegion(regionCode) to get the country calling code for each one (1, 44 etc) And then to get the actual names, you should use ICU4J ->

How to host the google libphonenumber locally?

廉价感情. 提交于 2019-11-29 00:55:12
问题 During development on my localhost, I am trying to self host the libphonenumber library. I am trying with the following: <script src="//closure-library.googlecode.com/svn/trunk/closure/goog/base.js"></script> <script>goog.require('goog.proto2.Message');</script> <script src="scripts/vendor/pn/phonemetadata.pb.js"></script> <script src="scripts/vendor/pn/phonenumber.pb.js"></script> <script src="scripts/vendor/pn/metadata.js"></script> <script src="scripts/vendor/pn/phonenumberutil.js"><

libphonenumber standalone (without masses of google dependencies)? Alternate lib?

爷,独闯天下 提交于 2019-11-28 16:39:05
问题 I am looking at using http://code.google.com/p/libphonenumber/ for a well-established project. Today the project does not use Google's libraries for JavaScript, favoring jQuery, jQueryUI, requirejs, and so on. libphonenumber looks awesome ... except that the javascript version (svn co http://libphonenumber.googlecode.com/svn/trunk/javascript/ libphonenumber-js) is laced with goog.require calls. If one runs the demo (libphonenumber-js/i18n/phonenumbers/demo.html if you checked out as suggested

icu4j is too big, any alternative?

我怕爱的太早我们不能终老 提交于 2019-11-28 00:53:22
问题 I am using icu4j in my android code. The jar is about 10MB, which causes my entire application to register an apk of 15MB. Of course the 15MB is likely due to Proguard helping reducing the size. Anyway, does anyone know of a smaller alternative to icu4j? I am using icu4j in conjunction with libphonenumber for one purpose only, which is detailed here, and which I reproduce below: You need: getSupportedRegions() to get the list of region codes getCountryCodeForRegion(regionCode) to get the

Extract code country from phone number [libphonenumber]

谁说胖子不能爱 提交于 2019-11-26 09:19:47
问题 I have a string like this : +33123456789 (french phone number). I want to extract the country code (+33) without knowing the country. For example, it should work if i have another phone from another country. I use the google library https://code.google.com/p/libphonenumber/. If I know the country, it is cool I can find the country code : PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance(); int countryCode = phoneUtil.getCountryCodeForRegion(locale.getCountry()); but I don\'t find a way