4

Can anyone please tell me about how to get 3 digit country code (for example India-IND) from latitude longitude

here is my code for getting 2 digit country code

  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();
Tabish Hussain
  • 852
  • 5
  • 13
M.Neelima
  • 221
  • 1
  • 10

1 Answers1

1

There is a simple way to do it:

address.getLocale().getISO3Country();

Here is more about Locale and ISO3 codes and some more about country codes.

AlphaQ
  • 656
  • 8
  • 18