Other than Locale.getISOCountries()
that is, because I'm already getting some strange errors with that. What else is the best way to get the 2-letter country codes as well as the full country name?
Java, also spelled Djawa or Jawa, island of Indonesia lying southeast of Malaysia and Sumatra, south of Borneo (Kalimantan), and west of Bali. Java is home to roughly half of Indonesia's population and dominates the country politically and economically.
Java (Indonesian: Jawa, Indonesian pronunciation: [ˈdʒawa]; Javanese: ꦗꦮ; Sundanese: ᮏᮝ) is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea to the north.
Show activity on this post. TelephonyManager tm = (TelephonyManager)getSystemService(getApplicationContext(). TELEPHONY_SERVICE); String countryCode = tm. getNetworkCountryIso();
The Java Locale class object represents a specific geographic, cultural, or political region. It is a mechanism to for identifying objects, not a container for the objects themselves. A Locale object logically consists of the fields like languages, script, country, variant, extensions.
See code snippets :
String[] countryCodes = Locale.getISOCountries(); for (String countryCode : countryCodes) { Locale obj = new Locale("", countryCode); System.out.println("Country Code = " + obj.getCountry() + ", Country Name = " + obj.getDisplayCountry()); }
Refer to this country list in Java for more examples.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With