Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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);
    list.add(obj.getDisplayCountry());
}
like image 666
Nizami Avatar asked Nov 08 '16 15:11

Nizami


People also ask

How many countries states and cities are there in the world?

There are 195 countries in the world today. This total comprises 193 countries that are member states of the United Nations and 2 countries that are non-member observer states: the Holy See and the State of Palestine.

How many cities and towns are there in the world?

Our database is: Up-to-date: It was last refreshed in March 2022. Comprehensive: Over 4 million unique cities and towns from every country in the world.

How many cities are countries?

Monaco, Singapore and Vatican City are the only three sovereign states that exist today. Also known as city-states, sovereign states operate independently, housing a whole country in just one city.

Which country has the most states?

Here's a breakdown: Australia has states, but only six. Brazil has 26 states and Mexico 31. India has 28 states and in Europe only one country has states: that's Germany with 16.


1 Answers

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.

like image 104
Jordan Avatar answered Oct 21 '22 07:10

Jordan