把经纬度显示定位在google地图 (精简)

private void showLocation() {
		MapController mc = mapView.getController();
		mc.setZoom(INITIAL_ZOOM_LEVEL);

		try {

			INITIAL_LATITUDE = (int) (Double.parseDouble(SLATITUDE) * 1E6);
			INITIAL_LONGITUDE = (int) (Double.parseDouble(SLONGITUDE) * 1000000);
			Log.i(TAG, INITIAL_LATITUDE + " " + INITIAL_LONGITUDE);

		} catch (Exception e) {
			e.printStackTrace();
		}

		mc.setCenter(new GeoPoint(INITIAL_LATITUDE, INITIAL_LONGITUDE));
		// 贴上标记
		mapOverlays = mapView.getOverlays();
		drawable = this.getResources().getDrawable(R.drawable.androidmarker);
		itemizedOverlay = new Map_ItemizedOverlay(drawable);

		GeoPoint point = new GeoPoint(INITIAL_LATITUDE, INITIAL_LONGITUDE);
		OverlayItem overlayitem = new OverlayItem(point, "", "");
		itemizedOverlay.addOverlay(overlayitem);
		mapOverlays.add(itemizedOverlay);
	}

你可能感兴趣的:(google地图)