github_32902495
Garnet-F
采纳率68%
2016-08-09 09:40 阅读 2.2k
已采纳

unable to parse response from server

private String getAddress(Double lat, Double lng) throws IOException {
    String add = "";
    Geocoder geocoder = new Geocoder(getApplicationContext(), Locale.getDefault());
    if(geocoder != null)
    try {
        List<Address> addresses = geocoder.getFromLocation(lat, lng,1);
        Log.e(TAG,"getAddress addresses = " + addresses);
         if (addresses.isEmpty()) { // 如果地址为空,则等待返回地址
             Toast.makeText(this,"Waiting for Location",Toast.LENGTH_LONG).show();
            }
        Address obj = addresses.get(0);

        add = obj.getAddressLine(0) + "" + obj.getAddressLine(1) + ""
                + obj.getAddressLine(2);
      } catch (IOException ioException) {
            //捕获IO流异常
            Log.e(TAG, "service_not_available" + ioException);
       } catch (IllegalArgumentException illegalArgumentException) {
            // 捕获纬度或经度值无效。
        Log.e(TAG, "Latitude = " + lat + ", Longitude = " + lng,
                illegalArgumentException);
        }
                        return add;

}
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

3条回答 默认 最新

  • 已采纳
    github_32902495 Garnet-F 2016-08-26 00:49

    goole map 封装的这个类是有问题哦,不能频繁的连接goole map 的服务器

    点赞 评论 复制链接分享
  • CSDNXIAOS Robot-S 2016-08-09 09:52

    Diagnostics -----------
    If an operation is taking significantly more time than expected or is compromising the performance of other operations, then the best place to check is v$session_wait. This vi......
    答案就在这里:No Response from the Server, Does it Hang or Spin?
    ----------------------Hi,地球人,我是问答机器人小S,上面的内容就是我狂拽酷炫叼炸天的答案,除了赞同,你还有别的选择吗?

    点赞 评论 复制链接分享
  • kun_tostudy kun_hello 2016-08-09 09:56

    我觉得是你把方法私有化的问题 把private改为public试试

    点赞 评论 复制链接分享

相关推荐