@SuppressLint("Override") public static String formatNumber(String phoneNumber,String defaultCountryIso){
  if (phoneNumber.startsWith("#") || phoneNumber.startsWith("*")) {
    return phoneNumber;
  }
  PhoneNumberUtil util=PhoneNumberUtil.getInstance();
  String result=null;
  try {
    Phonenumber.PhoneNumber pn=util.parseAndKeepRawInput(phoneNumber,defaultCountryIso);
    result=util.formatInOriginalFormat(pn,defaultCountryIso);
  }
 catch (  NumberParseException e) {
  }
  return result;
}

@ SuppressLint ( "Override" ) public static String formatNumber ( String phoneNumber , String defaultCountryIso ) { if ( phoneNumber . startsWith ( "#" ) || phoneNumber . startsWith ( "*" ) ) { return phoneNumber ; } PhoneNumberUtil util = PhoneNumberUtil . getInstance ( ) ; String result = null ; try { Phonenumber . PhoneNumber pn = util . parseAndKeepRawInput ( phoneNumber , defaultCountryIso ) ; result = util . formatInOriginalFormat ( pn , defaultCountryIso ) ; } catch ( NumberParseException e ) { } return result ; }
format a phone number . < p > if the given number doesn ' t have the country code , the phone will be formatted to the default country ' s convention .
