GeocoderUtils { public static String getGeocodedLocationFor(Context context, String phoneNumber, ClassLoader classLoader, boolean isForChina) { try { final String currentIso = isForChina ? Locale.CHINA.getCountry() : getCurrentCountryIso(context, classLoader); final Locale locale = isForChina ? Locale.CHINA : context.getResources().getConfiguration().locale; return getDescriptionForNumber(parsePhoneNumber(phoneNumber, currentIso), locale); } catch (NumberParseException e) { return null; } }  static String getGeocodedLocationFor(Context context, String phoneNumber, ClassLoader classLoader, boolean isForChina);  }
@Test public void testGetGeocodedLocationFor() throws Exception { final List<String> numberList = Arrays.asList("10086", "15573275419", "057157892157"); try { Locale locale = Locale.CHINA; final PhoneNumberUtil phoneNumberUtil = PhoneNumberUtil.getInstance(); for (String s : numberList) { Phonenumber.PhoneNumber phoneNumber = GeocoderUtils.parsePhoneNumber(s, locale.getCountry()); System.out.println("geocoder: " + GeocoderUtils.getDescriptionForNumber(phoneNumber, locale)); } } catch (NumberParseException e) { System.err.println("NumberParseException was thrown: " + e.toString()); } }