Пример #1
0
  protected void onCreate(Bundle savedInstanceState) {
    // TODO Auto-generated method stub
    super.onCreate(savedInstanceState);
    setContentView(R.layout.poisearch);

    BMapApiDemoApp app = (BMapApiDemoApp) this.getApplication();
    if (app.mBMapMan == null) {
      app.mBMapMan = new BMapManager(getApplication());
      app.mBMapMan.init(app.mStrKey, new BMapApiDemoApp.MyGeneralListener());
    }
    app.mBMapMan.start();
    // 如果使用地图SDK,请初始化地图Activity
    super.initMapActivity(app.mBMapMan);

    mMapView = (MapView) findViewById(R.id.bmapView);
    mMapView.setBuiltInZoomControls(true);
    // 设置在缩放动画过程中也显示overlay,默认为不绘制
    mMapView.setDrawOverlayWhenZooming(true);

    mBtnSearch = (Button) findViewById(R.id.search);

    OnClickListener clickListener =
        new OnClickListener() {
          public void onClick(View v) {
            SearchButtonProcess(v);
          }
        };
    mBtnSearch.setOnClickListener(clickListener);
  }
Пример #2
0
 @Override
 protected void onPause() {
   if (mBMapMan != null) {
     mBMapMan.stop();
   }
   super.onPause();
 }
Пример #3
0
 @Override
 protected void onResume() {
   if (mBMapMan != null) {
     mBMapMan.start();
   }
   super.onResume();
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    mapView = (MapView) findViewById(R.id.bmapview);
    mbtnAdress = (Button) findViewById(R.id.btnAddress);
    mbtnAdress.setOnClickListener(this);
    mbtnLine = (Button) findViewById(R.id.btnLine);
    mbtnLine.setOnClickListener(this);
    bMapManager = new BMapManager(this);
    bMapManager.init(
        key,
        new MKGeneralListener() {

          @Override
          public void onGetPermissionState(int arg0) {
            // TODO Auto-generated method stub
            if (arg0 == 300) {
              Toast.makeText(MainActivity.this, "输入的key有误", 1);
            }
          }

          @Override
          public void onGetNetworkState(int arg0) {}
        });
    bMapManager.start();
    initMapActivity(bMapManager);
    mapView.setBuiltInZoomControls(true); // 设置中心点
    mkSearch = new MKSearch();
    mkSearch.init(bMapManager, new MySearchListener(this, mapView));
  }
 @Override
 protected void onResume() {
   // TODO Auto-generated method stub
   super.onResume();
   if (bMapManager != null) {
     bMapManager.start();
   }
 }
 @Override
 protected void onDestroy() {
   super.onDestroy();
   if (bMapManager != null) {
     bMapManager.destroy();
     bMapManager = null;
   }
 }
Пример #7
0
 @Override
 protected void onDestroy() {
   if (mBMapMan != null) {
     mBMapMan.destroy();
     mBMapMan = null;
   }
   super.onDestroy();
 }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    layoutInflater = LayoutInflater.from(this);

    mapManager = ((MyApplication) getApplication()).getMapManager();
  }
Пример #9
0
 public void onResume() {
   mApplication.onResumeMapActivity();
   mMxLocationOverlay.enableMyLocation();
   mMxLocationOverlay.enableCompass();
   mCaricoOverlay.setData(mApplication.getCarPosition());
   // if (mMovingOverlay != null) {
   // mMovingOverlay.onResume();
   // }
   super.onResume();
   MobclickAgent.onResume(this);
 }
Пример #10
0
 @Override
 protected void onCreate(Bundle arg0) {
   super.onCreate(arg0);
   setContentView(R.layout.path);
   mPathActivity = this;
   mApplication = GlobalApplication.getApplication();
   checkInitMapActivity();
   checkInitMap();
   checkInitSearch();
   checkInitRoutes();
 }
Пример #11
0
 public void onPause() {
   mApplication.onPauseMapActivity();
   mMxLocationOverlay.disableMyLocation();
   mMxLocationOverlay.disableCompass(); // 关闭指南针
   // if (mMovingOverlay != null) {
   // mMovingOverlay.onPause();
   // }
   super.onPause();
   MobclickAgent.onPause(this);
   mActionBar.setProgressBarVisibility(View.GONE);
 }
Пример #12
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);
  }
Пример #13
0
 @Override
 protected void onPause() {
   mapManager.stop();
   super.onPause();
 }
Пример #14
0
 @Override
 protected void onResume() {
   mapManager.start();
   super.onResume();
 }
Пример #15
0
 protected void initMapActivity() {
   super.initMapActivity(mapManager);
   mapManager.start();
 }
Пример #16
0
 @Override
 public void onBackPressed() {
   super.onBackPressed();
   this.finish();
 }
Пример #17
0
 public void onDestroy() {
   super.onDestroy();
   // if (mMovingOverlay != null) {
   // mMovingOverlay.onDestroy();
   // }
 }
Пример #18
0
 @Override
 protected void onResume() {
   BMapApiDemoApp app = (BMapApiDemoApp) this.getApplication();
   app.mBMapMan.start();
   super.onResume();
 }