private void goToMyLocation() { LogManager.d("mapView height" + mapView.getMeasuredHeight()); View parent = (View) mapView.getParent(); LogManager.d("mapView height" + parent.getMeasuredHeight()); if (mCurrentLocation == null) { LogManager.d("找不到当前位置"); map_view_enable.setVisibility(View.VISIBLE); mapView.setVisibility(View.GONE); searchButton.setEnabled(false); // setMapCenter(mDefaultCurrentLocation); } else { searchButton.setEnabled(true); map_view_enable.setVisibility(View.GONE); mapView.setVisibility(View.VISIBLE); int getLatitude = (int) (mCurrentLocation.getLatitude() * 1e6); int getLongitude = (int) (mCurrentLocation.getLongitude() * 1e6); GeoPoint geoPoint = null; if (debugChinaDevice) { int latitude = (int) (44.648837 * 1e6); int longitude = (int) (10.920087000000001 * 1e6); geoPoint = new GeoPoint(latitude, longitude); } else { geoPoint = new GeoPoint(getLatitude, getLongitude); } setMapCenter(geoPoint); } }
protected void initOverlays() { mMapView = (MapView) findViewById(R.id.map); mMapController = mMapView.getController(); mPointerShadow = (PointerShadow) findViewById(R.id.pointer_shadow); mShadowOverlay = new PointerShadowOverlay(this, mPointerShadow); mLocatableItemOverlay = createItemOverlay(); mMapView.setBuiltInZoomControls(true); final List<Overlay> overlays = mMapView.getOverlays(); overlays.add(mLocatableItemOverlay); overlays.add(mShadowOverlay); mMapView.setVisibility(View.VISIBLE); }