这次要放的代码是把已知的经纬度标记在地图上。
<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();
}