【问题标题】:geocode google api stuck when convert address to lat long将地址转换为经纬度时,地理编码谷歌 api 卡住了
【发布时间】:2017-06-14 11:58:20
【问题描述】:

当我使用乌克兰地址点击 Geocode Google API 时,它会为客户端(乌克兰)的某些地址返回 null,但是当我在印度(在我这边)测试它时,它运行良好。

代码:

private LatLng getLocationFromAddress(final String place){
    LatLng loc = null;
    Geocoder gCoder = new Geocoder(getActivity() );

    try {
        final List<Address> list = gCoder.getFromLocationName(place, 1);

        if (list != null && list.size() > 0) {
            loc = new LatLng(list.get(0).getLatitude(), list.get(0).getLongitude());
        }
    }
    catch (IOException e) {
        e.printStackTrace();
    }

    return loc;
}

【问题讨论】:

  • 给我看代码,没有代码我们什么都做不了。

标签: java android google-api geocode


【解决方案1】:

显示代码。 还要从api检查地址是否不为空

【讨论】:

    猜你喜欢
    • 2012-08-10
    • 1970-01-01
    • 2011-11-21
    • 1970-01-01
    • 2013-09-06
    • 2012-06-14
    • 2011-10-27
    • 2015-06-16
    • 2013-10-01
    相关资源
    最近更新 更多