protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); /** * 使用地图sdk前需先初始化BMapManageResource. * BMapManager是全局的,可为多个MapView共用,它需要地图模块创建前创建, * 并在地图地图模块销毁后销毁,只要还有地图模块在使用,BMapManager就不应该销毁 */ DemoApplication app = (DemoApplication)this.Application; if (app.mBMapManager == null) { app.mBMapManager = new BMapManager(ApplicationContext); /** * 如果BMapManager没有初始化则初始化BMapManager */ app.mBMapManager.Init(new DemoApplication.MyGeneralListener()); } SetContentView(Resource.Layout.activity_poisearch); mMapView = FindViewById<MapView>(Resource.Id.bmapView); mMapView.Controller.EnableClick(true); mMapView.Controller.SetZoom(12); // 初始化搜索模块,注册搜索事件监听 mSearch = new MKSearch(); mSearch.Init(app.mBMapManager, new IMKSearchListenerImpl(this)); keyWorldsView = FindViewById<AutoCompleteTextView>(Resource.Id.searchkey); sugAdapter = new ArrayAdapter<string>(this, Android.Resource.Layout.SimpleDropDownItem1Line); keyWorldsView.Adapter = sugAdapter; /** * 当输入关键字变化时,动态更新建议列表 */ keyWorldsView.AddTextChangedListener(new ITextWatcherImpl(this)); }
private void InitSearcher() { mSearch = new MKSearch(); mSearch.Init(((DemoApplication)this.Application).mBMapManager, new IMKSearchListenerImpl(this)); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); /** * 使用地图sdk前需先初始化BMapManager. * BMapManager是全局的,可为多个MapView共用,它需要地图模块创建前创建, * 并在地图地图模块销毁后销毁,只要还有地图模块在使用,BMapManager就不应该销毁 */ DemoApplication app = (DemoApplication)this.Application; if (app.mBMapManager == null) { app.mBMapManager = new BMapManager(ApplicationContext); /** * 如果BMapManager没有初始化则初始化BMapManager */ app.mBMapManager.Init(new DemoApplication.MyGeneralListener()); } SetContentView(Resource.Layout.routeplan); ICharSequence titleLable = new String("路线规划功能"); Title = titleLable.ToString(); //初始化地图 mMapView = FindViewById<MapView>(Resource.Id.bmapView); mMapView.SetBuiltInZoomControls(false); mMapView.Controller.SetZoom(12); mMapView.Controller.EnableClick(true); //初始化按键 mBtnDrive = FindViewById<Button>(Resource.Id.drive); mBtnTransit = FindViewById<Button>(Resource.Id.transit); mBtnWalk = FindViewById<Button>(Resource.Id.walk); mBtnPre = FindViewById<Button>(Resource.Id.pre); mBtnNext = FindViewById<Button>(Resource.Id.next); mBtnCusRoute = FindViewById<Button>(Resource.Id.custombutton); mBtnCusIcon = FindViewById<Button>(Resource.Id.customicon); mBtnPre.Visibility = ViewStates.Invisible; mBtnNext.Visibility = ViewStates.Invisible; //按键点击事件 Android.Views.View.IOnClickListener clickListener = new ClickListenerImpl(this); Android.Views.View.IOnClickListener nodeClickListener = new NodeClickListenerImpl(this); Android.Views.View.IOnClickListener customClickListener = new CustomClickListenerImpl(this); Android.Views.View.IOnClickListener changeRouteIconListener = new ChangeRouteIconListenerImpl(this); mBtnDrive.SetOnClickListener(clickListener); mBtnTransit.SetOnClickListener(clickListener); mBtnWalk.SetOnClickListener(clickListener); mBtnPre.SetOnClickListener(nodeClickListener); mBtnNext.SetOnClickListener(nodeClickListener); mBtnCusRoute.SetOnClickListener(customClickListener); mBtnCusIcon.SetOnClickListener(changeRouteIconListener); //创建 弹出泡泡图层 CreatePaopao(); //地图点击事件处理 mMapView.RegMapTouchListner(new IMKMapTouchListenerImpl(this)); // 初始化搜索模块,注册事件监听 mSearch = new MKSearch(); mSearch.Init(app.mBMapManager, new IMKSearchListenerImpl(this)); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); /** * 使用地图sdk前需先初始化BMapManager. * BMapManager是全局的,可为多个MapView共用,它需要地图模块创建前创建, * 并在地图地图模块销毁后销毁,只要还有地图模块在使用,BMapManager就不应该销毁 */ DemoApplication app = (DemoApplication)this.Application; if (app.mBMapManager == null) { app.mBMapManager = new BMapManager(ApplicationContext); /** * 如果BMapManager没有初始化则初始化BMapManager */ app.mBMapManager.Init(new DemoApplication.MyGeneralListener()); } SetContentView(Resource.Layout.buslinesearch); ICharSequence titleLable = new String("公交线路查询功能"); Title = titleLable.ToString(); //地图初始化 mMapView = FindViewById<MapView>(Resource.Id.bmapView); mMapView.Controller.EnableClick(true); mMapView.Controller.SetZoom(12); busLineIDList = new List<string>(); //创建 弹出泡泡图层 CreatePaopao(); // 设定搜索按钮的响应 mBtnSearch = FindViewById<Button>(Resource.Id.search); mBtnNextLine = FindViewById<Button>(Resource.Id.nextline); mBtnPre = FindViewById<Button>(Resource.Id.pre); mBtnNext = FindViewById<Button>(Resource.Id.next); mBtnPre.Visibility = ViewStates.Invisible; mBtnNext.Visibility = ViewStates.Invisible; //地图点击事件处理 mMapView.RegMapTouchListner(new MKMapTouchListenerImpl(this)); // 初始化搜索模块,注册事件监听 mSearch = new MKSearch(); mSearch.Init(app.mBMapManager, new MKSearchListenerImpl(this)); Android.Views.View.IOnClickListener clickListener = new ClickListenerImpl(this); Android.Views.View.IOnClickListener nextLineClickListener = new NextLineClickListener(this); Android.Views.View.IOnClickListener nodeClickListener = new NodeClickListener(this); mBtnSearch.SetOnClickListener(clickListener); mBtnNextLine.SetOnClickListener(nextLineClickListener); mBtnPre.SetOnClickListener(nodeClickListener); mBtnNext.SetOnClickListener(nodeClickListener); //mBtnSearch.Click += (sender, e) => //{ // SearchButtonProcess(mBtnSearch); //}; //mBtnNextLine.Click += (sender, e) => //{ // SearchNextBusline(); //}; //mBtnPre.Click += (sender, e) => //{ // NodeClick(mBtnPre); //}; //mBtnNext.Click += (sender, e) => //{ // NodeClick(mBtnNext); //}; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); /** * 使用地图sdk前需先初始化BMapManager. * BMapManager是全局的,可为多个MapView共用,它需要地图模块创建前创建, * 并在地图地图模块销毁后销毁,只要还有地图模块在使用,BMapManager就不应该销毁 */ DemoApplication app = (DemoApplication)this.Application; if (app.mBMapManager == null) { app.mBMapManager = new BMapManager(ApplicationContext); /** * 如果BMapManager没有初始化则初始化BMapManager */ app.mBMapManager.Init(new DemoApplication.MyGeneralListener()); } SetContentView(Resource.Layout.activity_share_demo_activity); mMapView = FindViewById<MapView>(Resource.Id.bmapView); mMapView.Controller.EnableClick(true); mMapView.Controller.SetZoom(12); // 初始化搜索模块,注册搜索事件监听 mSearch = new MKSearch(); mSearch.Init(app.mBMapManager, new IMKSearchListenerImpl(this) { }); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); /** * 使用地图sdk前需先初始化BMapManager. * BMapManager是全局的,可为多个MapView共用,它需要地图模块创建前创建, * 并在地图地图模块销毁后销毁,只要还有地图模块在使用,BMapManager就不应该销毁 */ DemoApplication app = (DemoApplication)this.Application; if (app.mBMapManager == null) { app.mBMapManager = new BMapManager(ApplicationContext); /** * 如果BMapManager没有初始化则初始化BMapManager */ app.mBMapManager.Init(new DemoApplication.MyGeneralListener()); } SetContentView(Resource.Layout.geocoder); ICharSequence titleLable = new String("地理编码功能"); Title = titleLable.ToString(); //地图初始化 mMapView = FindViewById<MapView>(Resource.Id.bmapView); mMapView.Controller.EnableClick(true); mMapView.Controller.SetZoom(12); // 初始化搜索模块,注册事件监听 mSearch = new MKSearch(); mSearch.Init(app.mBMapManager, new IMKSearchListenerImpl(this)); // 设定地理编码及反地理编码按钮的响应 mBtnReverseGeoCode = FindViewById<Button>(Resource.Id.reversegeocode); mBtnGeoCode = FindViewById<Button>(Resource.Id.geocode); Android.Views.View.IOnClickListener clickListener = new ClickListenerImpl(this); mBtnReverseGeoCode.SetOnClickListener(clickListener); mBtnGeoCode.SetOnClickListener(clickListener); }