Nizami Nizami - 10 months ago 66
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.