【问题标题】:How to determine closest, largest city name with Android?如何使用 Android 确定最近、最大的城市名称?
【发布时间】:2011-06-03 13:48:47
【问题描述】:

我想知道如何根据手机当前位置或 Android 设备上的 IP 地址获取最近的城市名称。我愿意使用其他 API 将 GPS 坐标或 IP 地址转换为城市名称。最好的方法是什么? (我没有使用 Google 地图前端,但我愿意使用 API)。

最好的

【问题讨论】:

    标签: android location


    【解决方案1】:

    您可以使用 android.location.Geocoder 包中提供的 GeoCoder。 JavaDocs 在这里 JavaDocs here

    示例代码

    List<Address> list = geoCoder.getFromLocation(location
                        .getLatitude(), location.getLongitude(), 1);
                if (list != null & list.size() > 0) {
                    Address address = list.get(0);
                    result = address.getLocality();
                    return result;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-01-27
      • 2014-07-11
      • 2011-05-22
      • 1970-01-01
      • 2010-10-13
      • 1970-01-01
      相关资源
      最近更新 更多