Nizami Nizami - 1 year ago 102
Android Question

Getting list of countries, cities and their areas/states/towns respectively

Is this possible to load a list of all countries in a spinner, then on selecting the particular country, all of its cities appears in another spinner and after selecting the city, we get the list of areas or towns of that city in android using google-api or something like country picker?
Currently i am using this to get the list of countries. but how to get their respective cities and towns?

ArrayList<String> list=new ArrayList<String>();
String[] locales = Locale.getISOCountries();
for (String countryCode : locales) {
Locale obj = new Locale("", countryCode);

Answer Source

You can use the JSON file available here. Just add it to your project into the assets folder and add the list of cities and countries to spinner after parsing it.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download