Hey,
This code segment will get you all country names.
//Initializing Country List
final List<Country> countryList=new ArrayList<>();
public void fillCountryList(){
String[] countries = Locale.getISOCountries();
int j = 0;
// Loop each country
for(int i = 0; i < countries.length; i++) {
String country = countries[i];
Locale locale = new Locale("en", country);
// Get the country name by calling getDisplayCountry()
String countryName = locale.getDisplayCountry();
// Printing the country name on the console
countryList.add(new Country(countryName));
j++;
}
Log.d("MyApp", "Total Country # : " + j);
}
You can use this code segment even in your Android application without any problem.If you cannot understand how it is working, feel free to ask me :)