谁能帮我得到一份国家名单和他们的城市名单? 是否有用于获取这些列表的任何 google Api?
最佳答案
试试这个:
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());
}
并将列表设置为适配器。
我认为要获取城市,您必须使用网络服务。
引用这些链接:
关于android - 如何获取国家及其城市的列表?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36399613/