@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)); }
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); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); layoutInflater = LayoutInflater.from(this); mapManager = ((MyApplication) getApplication()).getMapManager(); }
@Override protected void onCreate(Bundle arg0) { super.onCreate(arg0); setContentView(R.layout.path); mPathActivity = this; mApplication = GlobalApplication.getApplication(); checkInitMapActivity(); checkInitMap(); checkInitSearch(); checkInitRoutes(); }
@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); }