@Override public void onReceive(Context context, Intent intent) { String action = intent.getAction(); if (action.equals(ConnectivityManager.CONNECTIVITY_ACTION)) { Log.d("test", "网络状态已经改变"); if (NetWorkHelper.isNetworkAvailable(context)) { // BaiduMapUtil.locate(baiduMap,scanTime,mLocationClient, // new BaiduMapUtil.MyListener(context,baiduMap,distance,mLatLng,mAddress,null)); BaiduMapUtil.locate(baiduMap); } else { T.show(context, context.getString(R.string.no_network_error)); } } }
private void initViews() { orderInfo = getIntent().getParcelableExtra(AutoCon.ORDER_INFO); mainTech = (TextView) findViewById(R.id.main_tech); mMapView = (MapView) findViewById(R.id.bdmapView); distance = (TextView) findViewById(R.id.distance); indentImage = (ImageView) findViewById(R.id.indent_image); indentText = (TextView) findViewById(R.id.indent_text); workTime = (TextView) findViewById(R.id.work_time); orderType = (TextView) findViewById(R.id.order_type); orderOwner = (TextView) findViewById(R.id.create_order_people); shopsLocation = (TextView) findViewById(R.id.shops_location); shopsAlias = (TextView) findViewById(R.id.shops_name); workNotes = (TextView) findViewById(R.id.work_notes); baiduMap = mMapView.getMap(); // 管理具体的某一个MapView对象,缩放,旋转,平移 MapStatusUpdate mapStatusUpdate = MapStatusUpdateFactory.zoomTo(BaiduMapUtil.defaultLevel); // 默认级别12 baiduMap.setMapStatus(mapStatusUpdate); // 设置缩放级别 BaiduMapUtil.hiddenBaiduLogo(mMapView); // 隐藏百度广告图标 mMapView.showZoomControls(false); mMapView.showScaleControl(true); // 默认是true,显示标尺 BaiduMapUtil.initData(); setListener(); if (orderInfo != null) { orderId = orderInfo.getId(); mainTech.setText(orderInfo.getMainTech().getName()); setData(orderInfo); } else { T.show(this, R.string.loading_data_failure); return; } }