2017-06-01 79 views
3

谁能告诉我如何从经纬度如何从纬度和经度获取3位国家代码的Android

在这里得到3位国家代码(例如印度-IND)是我的代码用于获取2数国家代码

latitude = gps.getLatitude(); 
    longitude = gps.getLongitude(); 
    geocoder = new Geocoder(getActivity(), Locale.getDefault()); 
    addresses = geocoder.getFromLocation(latitude, longitude, 1); 
    Country = addresses.get(0).getCountryName(); 
    String Country_code1=addresses.get(0).getCountryCode(); 
+1

http://country.io/iso3.json – madebydavid

+0

String Country_code1 = addresses.get(0).getCountryCode(); 你会在Country_code1中提供什么? – ashish

回答

1

有一个简单的方法来做到这一点:

address.getLocale().getISO3Country(); 

这里有更多关于LocaleISO3 codes和一些更多的国家codes

相关问题