百度地图第二波

这次要放的代码是把已知的经纬度标记在地图上。

 <pre name="code" class="java"> try {
            LocationDetailModel detailModel = FastJsonUtils.getSingleBean(result, LocationDetailModel.class);
            models = detailModel.getDatas();
            for (int i = 0; i < models.size(); i++) {
                DebugLogUtil.getInstance().Info("返回结果" + models.get(0).getPlace());
                try {//处理数据类型等的异常
                    latLng = new LatLng(Double.valueOf(models.get(i).getLatitude()),
                            Double.valueOf(models.get(i).getLongitude()));
                } catch (Exception e) {
                    i++;
                    DebugLogUtil.getInstance().Info("for循环异常 !" + e.getMessage());
                }
            }
            MapStatusUpdate statusUpdate = MapStatusUpdateFactory.newLatLng(latLng);//让坐标一直显示在地图中央
            mBaiduMap = mMapView.getMap();
            mBaiduMap.animateMapStatus(statusUpdate);
//            latLng = new LatLng(123, 35);
            BitmapDescriptor bitmap = BitmapDescriptorFactory.fromResource(R.drawable.icon_pois);
            OverlayOptions options1 = new MarkerOptions().position(latLng).icon(bitmap);
            Marker marker = (Marker) mBaiduMap.addOverlay(options1);
            Bundle bundle = new Bundle();
            bundle.putSerializable("latLng", "" + latLng);
            marker.setExtraInfo(bundle);
        } catch (Exception e) {
            toastShow("本时间段无足迹已显示随意位置\n请选择其他时间段");
            DebugLogUtil.getInstance().Info("进入异常 !" + e.getMessage());
            e.printStackTrace();
        }

 

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值