karthik
karthik

Reputation: 321

How to get a list of countries and their cities?

Can any one help me to get a list of countries and a list of their cities? Is there any google Api for getting these lists?

Upvotes: 2

Views: 6138

Answers (1)

Try this once:

ArrayList<String> list=new ArrayList<String>();

String[] locales = Locale.getISOCountries();

for (String countryCode : locales) {

    Locale obj = new Locale("", countryCode);

    System.out.println("Country Name = " + obj.getDisplayCountry());
    list.add(obj.getDisplayCountry());

}

and set the list to adapter.

I think to get cities you have to use webservices.

Refer these links:

1) List of countries and their cities in android

2) Retrieve a list of countries from the android OS

Upvotes: 6

Related Questions