Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/370.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在android studio中使用libphonenumber获取国家代码_Java_Android_Libphonenumber - Fatal编程技术网

Java 如何在android studio中使用libphonenumber获取国家代码

Java 如何在android studio中使用libphonenumber获取国家代码,java,android,libphonenumber,Java,Android,Libphonenumber,基本上我不知道如何在android studio中使用libphonenumber来获得国家代码,比如(+91) 我试过了,但它给了我输入号码的前两个字母 phoneUtil = PhoneNumberUtil.createInstance(Name.this); try { // phone must begin with '+' Phonenumber.PhoneNumber numberProto = phoneUtil.parse(&quo

基本上我不知道如何在android studio中使用libphonenumber来获得国家代码,比如(+91) 我试过了,但它给了我输入号码的前两个字母

    phoneUtil = PhoneNumberUtil.createInstance(Name.this);
    try {
        // phone must begin with '+'
        Phonenumber.PhoneNumber numberProto = phoneUtil.parse("+"+phone, null);
        countryCode= numberProto.getCountryCode();
    } catch (NumberParseException e) {
        System.err.println("NumberParseException was thrown: " + e.toString());
    }

这可能对你有帮助

    public static String getMobileNoWithCode(String mobileNo) {
    try {
        List<Country> countries=Countries.getCountries();
        PhoneNumberUtil phoneUtil = PhoneNumberUtil.getInstance();
        for (Country country :countries){
        Phonenumber.PhoneNumber phNumberProto = phoneUtil.parse(
                mobileNo, country.getDCode());
        if (phoneUtil.isValidNumber(phNumberProto))
            return country.getDCode()+mobileNo;
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
    return "";
}
public静态字符串getMobileNoWithCode(字符串mobileNo){
试一试{
List countries=countries.getCountries();
PhoneNumberUtil phoneUtil=PhoneNumberUtil.getInstance();
适用于(国家:国家){
Phonenumber.Phonenumber phNumberProto=phoneUtil.parse(
mobileNo,country.getDCode());
if(phoneUtil.isValidNumber(phNumberProto))
返回国家/地区。getDCode()+mobileNo;
}
}捕获(例外e){
e、 printStackTrace();
}
返回“”;
}
国家级

public class Countries {

private static final Country[] COUNTRIES = {
        new Country("AF", "Afghanistan", "+93", "AFN"),
        new Country("AX", "Aland Islands", "+358", "EUR"),
        new Country("AL", "Albania", "+355", "ALL"),
        new Country("DZ", "Algeria", "+213", "DZD"),
        new Country("AS", "American Samoa", "+1", "USD"),
        new Country("AD", "Andorra", "+376", "EUR"),
        new Country("AO", "Angola", "+244", "AOA"),
        new Country("AI", "Anguilla", "+1", "XCD"),
        new Country("AQ", "Antarctica", "+672", "USD"),
        new Country("AG", "Antigua and Barbuda", "+1", "XCD"),
        new Country("AR", "Argentina", "+54", "ARS"),
        new Country("AM", "Armenia", "+374", "AMD"),
        new Country("AW", "Aruba", "+297", "AWG"),
        new Country("AU", "Australia", "+61", "AUD"),
        new Country("AT", "Austria", "+43", "EUR"),
        new Country("AZ", "Azerbaijan", "+994", "AZN"),
        new Country("BS", "Bahamas", "+1", "BSD"),
        new Country("BH", "Bahrain", "+973", "BHD"),
        new Country("BD", "Bangladesh", "+880", "BDT"),
        new Country("BB", "Barbados", "+1", "BBD"),
        new Country("BY", "Belarus", "+375", "BYR"),
        new Country("BE", "Belgium", "+32", "EUR"),
        new Country("BZ", "Belize", "+501", "BZD"),
        new Country("BJ", "Benin", "+229", "XOF"),
        new Country("BM", "Bermuda", "+1", "BMD"),
        new Country("BT", "Bhutan", "+975", "BTN"),
        new Country("BO", "Bolivia, Plurinational State of", "+591", "BOB"),
        new Country("BA", "Bosnia and Herzegovina", "+387", "BAM"),
        new Country("BQ", "Bonaire", "+599", "USD"),
        new Country("BW", "Botswana", "+267", "BWP"),
        new Country("BV", "Bouvet Island", "+47", "NOK"),
        new Country("BR", "Brazil", "+55", "BRL"),
        new Country("IO", "British Indian Ocean Territory", "+246", "USD"),
        new Country("BN", "Brunei Darussalam", "+673", "BND"),
        new Country("BG", "Bulgaria", "+359", "BGN"),
        new Country("BF", "Burkina Faso", "+226", "XOF"),
        new Country("BI", "Burundi", "+257", "BIF"),
        new Country("KH", "Cambodia", "+855", "KHR"),
        new Country("CM", "Cameroon", "+237", "XAF"),
        new Country("CA", "Canada", "+1", "CAD"),
        new Country("CV", "Cape Verde", "+238", "CVE"),
        new Country("KY", "Cayman Islands", "+345", "KYD"),
        new Country("CF", "Central African Republic", "+236", "XAF"),
        new Country("TD", "Chad", "+235", "XAF"),
        new Country("CL", "Chile", "+56", "CLP"),
        new Country("CN", "China", "+86", "CNY"),
        new Country("CX", "Christmas Island", "+61", "AUD"),
        new Country("CC", "Cocos (Keeling) Islands", "+61", "AUD"),
        new Country("CO", "Colombia", "+57", "COP"),
        new Country("KM", "Comoros", "+269", "KMF"),
        new Country("CD", "Congo, The Democratic Republic of the", "+243", "CDF"),
        new Country("CG", "Congo", "+242", "XAF"),
        new Country("CK", "Cook Islands", "+682", "NZD"),
        new Country("CR", "Costa Rica", "+506", "CRC"),
        new Country("HR", "Croatia", "+385", "HRK"),
        new Country("CU", "Cuba", "+53", "CUP"),
        new Country("CW", "Curacao", "+599", "ANG"),
        new Country("CY", "Cyprus", "+357", "EUR"),
        new Country("CZ", "Czech Republic", "+420", "CZK"),
        new Country("DK", "Denmark", "+45", "DKK"),
        new Country("DJ", "Djibouti", "+253", "DJF"),
        new Country("DM", "Dominica", "+1", "XCD"),
        new Country("DO", "Dominican Republic", "+1", "DOP"),
        new Country("TL", "East Timor", "+670", "USD"),
        new Country("EC", "Ecuador", "+593", "USD"),
        new Country("EG", "Egypt", "+20", "EGP"),
        new Country("SV", "El Salvador", "+503", "SVC"),
        new Country("GQ", "Equatorial Guinea", "+240", "XAF"),
        new Country("ER", "Eritrea", "+291", "ERN"),
        new Country("EE", "Estonia", "+372", "EUR"),
        new Country("ET", "Ethiopia", "+251", "ETB"),
        new Country("FK", "Falkland Islands (Malvinas)", "+500", "FKP"),
        new Country("FO", "Faroe Islands", "+298", "DKK"),
        new Country("FJ", "Fiji", "+679", "FJD"),
        new Country("FI", "Finland", "+358", "EUR"),
        new Country("FR", "France", "+33", "EUR"),
        new Country("GF", "French Guiana", "+594", "EUR"),
        new Country("TF", "French Southern Territories", "+262", "EUR"),
        new Country("PF", "French Polynesia", "+689", "XPF"),
        new Country("GA", "Gabon", "+241", "XAF"),
        new Country("GM", "Gambia", "+220", "GMD"),
        new Country("GE", "Georgia", "+995", "GEL"),
        new Country("DE", "Germany", "+49", "EUR"),
        new Country("GH", "Ghana", "+233", "GHS"),
        new Country("GI", "Gibraltar", "+350", "GIP"),
        new Country("GR", "Greece", "+30", "EUR"),
        new Country("GL", "Greenland", "+299", "DKK"),
        new Country("GD", "Grenada", "+1", "XCD"),
        new Country("GP", "Guadeloupe", "+590", "EUR"),
        new Country("GU", "Guam", "+1", "USD"),
        new Country("GT", "Guatemala", "+502", "GTQ"),
        new Country("GG", "Guernsey", "+44", "GGP"),
        new Country("GN", "Guinea", "+224", "GNF"),
        new Country("GW", "Guinea-Bissau", "+245", "XOF"),
        new Country("GY", "Guyana", "+595", "GYD"),
        new Country("HT", "Haiti", "+509", "HTG"),
        new Country("HM", "Heard Island and McDonald Islands", "+000", "AUD"),
        new Country("VA", "Holy See (Vatican City State)", "+379", "EUR"),
        new Country("HN", "Honduras", "+504", "HNL"),
        new Country("HK", "Hong Kong", "+852", "HKD"),
        new Country("HU", "Hungary", "+36", "HUF"),
        new Country("IS", "Iceland", "+354", "ISK"),
        Utils.getDefaultCountry(),
        new Country("ID", "Indonesia", "+62", "IDR"),
        new Country("IR", "Iran, Islamic Republic of", "+98", "IRR"),
        new Country("IQ", "Iraq", "+964", "IQD"),
        new Country("IE", "Ireland", "+353", "EUR"),
        new Country("IM", "Isle of Man", "+44", "GBP"),
        new Country("IL", "Israel", "+972", "ILS"),
        new Country("IT", "Italy", "+39", "EUR"),
        new Country("CI", "Ivory Coast", "+225", "XOF"),
        new Country("JM", "Jamaica", "+1", "JMD"),
        new Country("JP", "Japan", "+81", "JPY"),
        new Country("JE", "Jersey", "+44", "JEP"),
        new Country("JO", "Jordan", "+962", "JOD"),
        new Country("KZ", "Kazakhstan", "+7", "KZT"),
        new Country("KE", "Kenya", "+254", "KES"),
        new Country("KI", "Kiribati", "+686", "AUD"),
        new Country("XK", "Kosovo", "+383", "EUR"),
        new Country("KW", "Kuwait", "+965", "KWD"),
        new Country("KG", "Kyrgyzstan", "+996", "KGS"),
        new Country("LA", "Lao People's Democratic Republic", "+856", "LAK"),
        new Country("LV", "Latvia", "+371", "LVL"),
        new Country("LB", "Lebanon", "+961", "LBP"),
        new Country("LS", "Lesotho", "+266", "LSL"),
        new Country("LR", "Liberia", "+231", "LRD"),
        new Country("LY", "Libyan Arab Jamahiriya", "+218", "LYD"),
        new Country("LI", "Liechtenstein", "+423", "CHF"),
        new Country("LT", "Lithuania", "+370", "LTL"),
        new Country("LU", "Luxembourg", "+352", "EUR"),
        new Country("MO", "Macao", "+853", "MOP"),
        new Country("MK", "Macedonia, The Former Yugoslav Republic of", "+389",
                "MKD"),
        new Country("MG", "Madagascar", "+261", "MGA"),
        new Country("MW", "Malawi", "+265", "MWK"),
        new Country("MY", "Malaysia", "+60", "MYR"),
        new Country("MV", "Maldives", "+960", "MVR"),
        new Country("ML", "Mali", "+223", "XOF"),
        new Country("MT", "Malta", "+356", "EUR"),
        new Country("MH", "Marshall Islands", "+692", "USD"),
        new Country("MQ", "Martinique", "+596", "EUR"),
        new Country("MR", "Mauritania", "+222", "MRO"),
        new Country("MU", "Mauritius", "+230", "MUR"),
        new Country("YT", "Mayotte", "+262", "EUR"),
        new Country("MX", "Mexico", "+52", "MXN"),
        new Country("FM", "Micronesia, Federated States of", "+691", "USD"),
        new Country("MD", "Moldova, Republic of", "+373", "MDL"),
        new Country("MC", "Monaco", "+377", "EUR"),
        new Country("MN", "Mongolia", "+976", "MNT"),
        new Country("ME", "Montenegro", "+382", "EUR"),
        new Country("MS", "Montserrat", "+1", "XCD"),
        new Country("MA", "Morocco", "+212", "MAD"),
        new Country("MZ", "Mozambique", "+258", "MZN"),
        new Country("MM", "Myanmar", "+95", "MMK"),
        new Country("NA", "Namibia", "+264", "NAD"),
        new Country("NR", "Nauru", "+674", "AUD"),
        new Country("NP", "Nepal", "+977", "NPR"),
        new Country("NL", "Netherlands", "+31", "EUR"),
        new Country("NC", "New Caledonia", "+687", "XPF"),
        new Country("NZ", "New Zealand", "+64", "NZD"),
        new Country("NI", "Nicaragua", "+505", "NIO"),
        new Country("NE", "Niger", "+227", "XOF"),
        new Country("NG", "Nigeria", "+234", "NGN"),
        new Country("NU", "Niue", "+683", "NZD"),
        new Country("NF", "Norfolk Island", "+672", "AUD"),
        new Country("MP", "Northern Mariana Islands", "+1", "USD"),
        new Country("KP", "North Korea", "+850", "KPW"),
        new Country("NO", "Norway", "+47", "NOK"),
        new Country("OM", "Oman", "+968", "OMR"),
        new Country("PK", "Pakistan", "+92", "PKR"),
        new Country("PW", "Palau", "+680", "USD"),
        new Country("PS", "Palestinian Territory, Occupied", "+970", "ILS"),
        new Country("PA", "Panama", "+507", "PAB"),
        new Country("PG", "Papua New Guinea", "+675", "PGK"),
        new Country("PY", "Paraguay", "+595", "PYG"),
        new Country("PE", "Peru", "+51", "PEN"),
        new Country("PH", "Philippines", "+63", "PHP"),
        new Country("PN", "Pitcairn", "+872", "NZD"),
        new Country("PL", "Poland", "+48", "PLN"),
        new Country("PT", "Portugal", "+351", "EUR"),
        new Country("PR", "Puerto Rico", "+1", "USD"),
        new Country("QA", "Qatar", "+974", "QAR"),
        new Country("RO", "Romania", "+40", "RON"),
        new Country("RU", "Russia", "+7", "RUB"),
        new Country("RW", "Rwanda", "+250", "RWF"),
        new Country("RE", "Reunion", "+262", "EUR"),
        new Country("BL", "Saint Barthelemy", "+590", "EUR"),
        new Country("SH", "Saint Helena, Ascension and Tristan Da Cunha", "+290",
                "SHP"),
        new Country("KN", "Saint Kitts and Nevis", "+1", "XCD"),
        new Country("LC", "Saint Lucia", "+1", "XCD"),
        new Country("MF", "Saint Martin", "+590", "EUR"),
        new Country("PM", "Saint Pierre and Miquelon", "+508", "EUR"),
        new Country("VC", "Saint Vincent and the Grenadines", "+1", "XCD"),
        new Country("WS", "Samoa", "+685", "WST"),
        new Country("SM", "San Marino", "+378", "EUR"),
        new Country("ST", "Sao Tome and Principe", "+239", "STD"),
        new Country("SA", "Saudi Arabia", "+966", "SAR"),
        new Country("SN", "Senegal", "+221", "XOF"),
        new Country("RS", "Serbia", "+381", "RSD"),
        new Country("SC", "Seychelles", "+248", "SCR"),
        new Country("SL", "Sierra Leone", "+232", "SLL"),
        new Country("SG", "Singapore", "+65", "SGD"),
        new Country("SX", "Sint Maarten", "+1", "ANG"),
        new Country("SK", "Slovakia", "+421", "EUR"),
        new Country("SI", "Slovenia", "+386", "EUR"),
        new Country("SB", "Solomon Islands", "+677", "SBD"),
        new Country("SO", "Somalia", "+252", "SOS"),
        new Country("ZA", "South Africa", "+27", "ZAR"),
        new Country("SS", "South Sudan", "+211", "SSP"),
        new Country("GS", "South Georgia and the South Sandwich Islands", "+500",
                "GBP"),
        new Country("KR", "South Korea", "+82", "KRW"),
        new Country("ES", "Spain", "+34", "EUR"),
        new Country("LK", "Sri Lanka", "+94", "LKR"),
        new Country("SD", "Sudan", "+249", "SDG"),
        new Country("SR", "Suriname", "+597", "SRD"),
        new Country("SJ", "Svalbard and Jan Mayen", "+47", "NOK"),
        new Country("SZ", "Swaziland", "+268", "SZL"),
        new Country("SE", "Sweden", "+46", "SEK"),
        new Country("CH", "Switzerland", "+41", "CHF"),
        new Country("SY", "Syrian Arab Republic", "+963", "SYP"),
        new Country("TW", "Taiwan", "+886", "TWD"),
        new Country("TJ", "Tajikistan", "+992", "TJS"),
        new Country("TZ", "Tanzania, United Republic of", "+255", "TZS"),
        new Country("TH", "Thailand", "+66", "THB"),
        new Country("TG", "Togo", "+228", "XOF"),
        new Country("TK", "Tokelau", "+690", "NZD"),
        new Country("TO", "Tonga", "+676", "TOP"),
        new Country("TT", "Trinidad and Tobago", "+1", "TTD"),
        new Country("TN", "Tunisia", "+216", "TND"),
        new Country("TR", "Turkey", "+90", "TRY"),
        new Country("TM", "Turkmenistan", "+993", "TMT"),
        new Country("TC", "Turks and Caicos Islands", "+1", "USD"),
        new Country("TV", "Tuvalu", "+688", "AUD"),
        new Country("UM", "U.S. Minor Outlying Islands", "+1", "USD"),
        new Country("UG", "Uganda", "+256", "UGX"),
        new Country("UA", "Ukraine", "+380", "UAH"),
        new Country("AE", "United Arab Emirates", "+971", "AED"),
        new Country("GB", "United Kingdom", "+44", "GBP"),
        new Country("US", "United States", "+1", "USD"),
        new Country("UY", "Uruguay", "+598", "UYU"),
        new Country("UZ", "Uzbekistan", "+998", "UZS"),
        new Country("VU", "Vanuatu", "+678", "VUV"),
        new Country("VE", "Venezuela, Bolivarian Republic of", "+58", "VEF"),
        new Country("VN", "Vietnam", "+84", "VND"),
        new Country("VG", "Virgin Islands, British", "+1", "USD"),
        new Country("VI", "Virgin Islands, U.S.", "+1", "USD"),
        new Country("WF", "Wallis and Futuna", "+681", "XPF"),
        new Country("EH", "Western Sahara", "+212", "MAD"),
        new Country("YE", "Yemen", "+967", "YER"),
        new Country("ZM", "Zambia", "+260", "ZMW"),
        new Country("ZW", "Zimbabwe", "+263", "USD"),

};

public static List<Country> getCountries() {
    return new ArrayList<>(Arrays.asList(COUNTRIES));
}}
公共类国家{
私人静态最终国家[]国家={
新国家(“AF”,“阿富汗”,“93”,“AFN”),
新国家(“AX”,“阿兰群岛”,“+358”,“欧元”),
新国家(“AL”、“阿尔巴尼亚”、“+355”、“全部”),
新国家(“DZ”、“阿尔及利亚”、“+213”、“DZD”),
新国家(“AS”、“美属萨摩亚”、“1”、“美元”),
新国家(“AD”、“安道尔”、“+376”、“欧元”),
新国家(“AO”、“安哥拉”、“+244”、“AOA”),
新国家(“AI”、“安圭拉”、“+1”、“XCD”),
新国家(“AQ”、“南极洲”、“+672”、“美元”),
新国家(“AG”、“安提瓜和巴布达”、“+1”、“XCD”),
新国家(“AR”、“阿根廷”、“+54”、“ARS”),
新国家(“AM”、“亚美尼亚”、“+374”、“AMD”),
新国家(“AW”、“阿鲁巴”、“+297”、“AWG”),
新国家(“非盟”、“澳大利亚”、“+61”、“澳元”),
新的国家(“奥地利”,“+43”,“欧元”),
新国家(“AZ”、“阿塞拜疆”、“+994”、“AZN”),
新国家(“BS”、“巴哈马”、“+1”、“BSD”),
新国家(“BH”、“巴林”、“+973”、“BHD”),
新国家(“BD”、“孟加拉国”、“+880”、“BDT”),
新国家(“BB”、“巴巴多斯”、“+1”、“BBD”),
新国家(“BY”,“白俄罗斯”,“+375”,“BYR”),
新国家(“BE”、“比利时”、“+32”、“欧元”),
新国家(“BZ”、“伯利兹”、“+501”、“BZD”),
新国家(“BJ”、“贝宁”、“+229”、“XOF”),
新国家(“BM”、“百慕大”、“+1”、“BMD”),
新国家(“BT”、“不丹”、“+975”、“BTN”),
新国家(“BO”,“玻利维亚,多民族国家”,“591”,“BOB”),
新国家(“BA”、“波斯尼亚和黑塞哥维那”、“+387”、“BAM”),
新国家(“BQ”、“博内尔”、“599”、“美元”),
新国家(“BW”、“博茨瓦纳”、“+267”、“BWP”),
新国家(“BV”、“Bouvet岛”、“+47”、“挪威”),
新国家(“巴西”、“巴西”、“55”、“巴西”),
新国家(“IO”,“英属印度洋领土”,“+246”,“美元”),
新国家(“BN”、“文莱达鲁萨兰国”、“+673”、“BND”),
新国家(“保加利亚”、“保加利亚”、“+359”、“保加利亚”),
新国家(“BF”、“布基纳法索”、“+226”、“XOF”),
新国家(“BI”、“布隆迪”、“+257”、“BIF”),
新国家(“KH”、“柬埔寨”、“+855”、“KHR”),
新国家(“CM”、“喀麦隆”、“+237”、“XAF”),
新国家(“CA”、“加拿大”、“1”、“CAD”),
新国家(“CV”、“佛得角”、“+238”、“CVE”),
新国家(“肯塔基”,“开曼群岛”,“+345”,“肯塔基”),
新国家(“CF”、“中非共和国”、“+236”、“XAF”),
新国家(“TD”、“乍得”、“+235”、“XAF”),
新国家(“CL”、“智利”、“+56”、“中电”),
新国家(“中国”、“中国”、“+86”、“人民币”),
新国家(“CX”、“圣诞岛”、“+61”、“澳元”),
新国家(“CC”、“科科斯(基林)群岛”、“+61”、“澳元”),
新国家(“CO”、“哥伦比亚”、“+57”、“缔约方会议”),
新国家(“KM”、“科摩罗”、“+269”、“KMF”),
新国家(“裁谈会”、“刚果、刚果民主共和国”、“加243”、“裁谈会”),
新国家(“CG”、“刚果”、“+242”、“XAF”),
新国家(“CK”、“库克群岛”、“+682”、“新西兰”),
新国家(“CR”、“哥斯达黎加”、“+506”、“CRC”),
新国家(“HR”、“克罗地亚”、“385”、“HRK”),
新国家(“CU”、“古巴”、“53”、“杯”),
新国家(“CW”、“库拉索岛”、“+599”、“ANG”),
新国家(“塞浦路斯”、“塞浦路斯”、“+357”、“欧元”),
新国家(“捷克共和国”、“捷克共和国”、“+420”、“捷克克朗”),
新国家(“丹麦”、“丹麦”、“+45”、“丹麦”),
新国家(“DJ”、“吉布提”、“+253”、“DJF”),
新国家(“DM”、“多米尼加”、“+1”、“XCD”),
新国家(“DO”、“多米尼加共和国”、“+1”、“DOP”),
新国家(“TL”,“东帝汶”,“+670”,“美元”),
新国家(“欧共体”、“厄瓜多尔”、“593”、“美元”),
新国家(“EG”、“埃及”、“20+EGP”),
新国家(“SV”、“萨尔瓦多”、“+503”、“SVC”),
新国家(“GQ”、“赤道几内亚”、“+240”、“XAF”),
新国家(“ER”、“厄立特里亚”、“+291”、“ERN”),
新国家(“EE”、“爱沙尼亚”、“+372”、“欧元”),
新国家(“ET”、“埃塞俄比亚”、“+251”、“ETB”),
新国家(“FK”、“福克兰群岛(马尔维纳斯)”、“+500”、“FKP”),
新国家(“FO”、“法罗群岛”、“+298”、“DKK”),
新国家(“FJ”、“斐济”、“+679”、“FJD”),
新国家(“金融机构”、“芬兰”、“+358”、“欧元”),
新国家(“法国”、“法国”、“+33”、“欧元”),
新国家(“GF”、“法属圭亚那”、“594”、“欧元”),
新国家(“TF”、“法国南部地区”、“+262”、“欧元”),
新国家(“PF”、“法属波利尼西亚”、“+689”、“XPF”),
新国家(“GA”、“加蓬”、“+241”、“XAF”),
新国家(“GM”、“冈比亚”、“+220”、“GMD”),
新国家(“通用电气”、“格鲁吉亚”、“+995”、“凝胶”),
新国家(“德”、“德”、“49”、“欧元”),
新国家(“GH”、“加纳”、“+233”、“GHS”),
新国家(“GI”、“直布罗陀”、“+350”、“GIP”),
新国家(“GR”、“希腊”、“+30”、“欧元”),
新国家(“GL”、“格陵兰岛”、“+299”、“丹麦克朗”),
新国家(“GD”、“格林纳达”、“+1”、“XCD”),
新国家(“GP”、“瓜德罗普岛”、“+590”、“欧元”),
新国家(“古”、“关岛”、“+1”、“美元”),
新国家(“GT”、“危地马拉”、“+502”、“GTQ”
public class Country implements Parcelable {

public static final Creator<Country> CREATOR = new Creator<Country>() {
    @Override
    public Country createFromParcel(Parcel in) {
        return new Country(in);
    }

    @Override
    public Country[] newArray(int size) {
        return new Country[size];
    }
};
private String name;
private String code;
@SerializedName("dial_code")
private String dCode;

public Country(String code, String name, String dCode, String eur) {
    this.code = code;
    this.name = name;
    this.dCode = dCode;
}

private Country(Parcel in) {
    name = in.readString();
    code = in.readString();
    dCode = in.readString();
}

public String getName() {
    return name;
}

public String getCode() {
    return code;
}

public String getDCode() {
    return dCode;
}

@Override
public int describeContents() {
    return 0;
}

@Override
public void writeToParcel(Parcel dest, int flags) {
    dest.writeString(name);
    dest.writeString(code);
    dest.writeString(dCode);
}}