您可能应该遵循以下步骤
1)查询您的数据库以获取城市列表
2)获取每个城市的纬度/经度
这是执行此操作的示例代码
String location=cityName;
String inputLine = "";
String result = ""
location=location.replaceAll(" ", "%20");
String myUrl="http://maps.google.com/maps/geo?q="+location+"&output=csv";
try{
URL url=new URL(myUrl);
URLConnection urlConnection=url.openConnection();
BufferedReader in = new BufferedReader(new
InputStreamReader(urlConnection.getInputStream()));
while ((inputLine = in.readLine()) != null) {
result=inputLine;
}
String lat = result.substring(6, result.lastIndexOf(","));
String longi = result.substring(result.lastIndexOf(",") + 1);
}
catch(Exception e){
e.printStackTrace();
}
3)现在您有了每个城市的纬度经度,您可以在地图上显示这些标记
这里是标记详细信息的链接
如果您需要更多信息,请在下方评论。:)
干杯!!