Пример #1
0
  @Override
  public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    mBMapMan = new BMapManager(getApplication());
    mBMapMan.init("C852FAE280E276186DE82EB547721866666283B0", null);
    super.initMapActivity(mBMapMan);

    mapView = (MapView) findViewById(R.id.mapview);
    mapView.setBuiltInZoomControls(true);

    mapOverlays = mapView.getOverlays();

    // first overlay
    drawable = getResources().getDrawable(R.drawable.marker);
    itemizedOverlay = new CustomItemizedOverlay<CustomOverlayItem>(drawable, mapView);

    GeoPoint point = new GeoPoint((int) (39.90923 * 1E6), (int) (116.397428 * 1E6));
    CustomOverlayItem overlayItem =
        new CustomOverlayItem(
            point,
            "Tomorrow Never Dies (1997)",
            "(M gives Bond his mission in Daimler car)",
            "http://ia.media-imdb.com/images/M/MV5BMTM1MTk2ODQxNV5BMl5BanBnXkFtZTcwOTY5MDg0NA@@._V1._SX40_CR0,0,40,54_.jpg");
    itemizedOverlay.addOverlay(overlayItem);

    GeoPoint point2 = new GeoPoint((int) (39.9022 * 1E6), (int) (116.3922 * 1E6));
    CustomOverlayItem overlayItem2 =
        new CustomOverlayItem(
            point2,
            "GoldenEye (1995)",
            "(Interiors Russian defence ministry council chambers in St Petersburg)",
            "http://ia.media-imdb.com/images/M/MV5BMzk2OTg4MTk1NF5BMl5BanBnXkFtZTcwNjExNTgzNA@@._V1._SX40_CR0,0,40,54_.jpg");
    itemizedOverlay.addOverlay(overlayItem2);

    mapOverlays.add(itemizedOverlay);

    // second overlay
    drawable2 = getResources().getDrawable(R.drawable.marker2);
    itemizedOverlay2 = new CustomItemizedOverlay<CustomOverlayItem>(drawable2, mapView);

    GeoPoint point3 = new GeoPoint((int) (39.917723 * 1E6), (int) (116.3722 * 1E6));
    CustomOverlayItem overlayItem3 =
        new CustomOverlayItem(point3, "Sliding Doors (1998)", "(interiors)", null);
    itemizedOverlay2.addOverlay(overlayItem3);

    GeoPoint point4 = new GeoPoint((int) (51.51738 * 1E6), (int) (-0.08186 * 1E6));
    CustomOverlayItem overlayItem4 =
        new CustomOverlayItem(
            point4,
            "Mission: Impossible (1996)",
            "(Ethan & Jim cafe meeting)",
            "http://ia.media-imdb.com/images/M/MV5BMjAyNjk5Njk0MV5BMl5BanBnXkFtZTcwOTA4MjIyMQ@@._V1._SX40_CR0,0,40,54_.jpg");
    itemizedOverlay2.addOverlay(overlayItem4);

    mapOverlays.add(itemizedOverlay2);

    final MapController mc = mapView.getController();
    mc.animateTo(point2);
    mc.setZoom(16);
  }
 /**
  * Animates to the given center point. Override to customize how the MapView is animated to the
  * given center point
  *
  * @param index The index of the item to center
  * @param center The center point of the item
  */
 protected void animateTo(int index, GeoPoint center) {
   mc.animateTo(center);
 }