百度地图PopupOverlay点击事件

来源:互联网 发布:矩阵论视频教程 编辑:程序博客网 时间:2024/04/30 10:42
通过Activity A跳转到带MapView的Acitivity B,点击POI弹出popup,点击popup显示字符串。
当我结束掉Activity B回到Activity A 后再次利用Intent 至Activity B时候发现Popup可以显示,但是监听事件无法起作用。


原因:在结束掉activity之前先得吧弹出的那个popup关闭掉,要不然无法监听到下次的点击事件

解决方案:

@Override  

protectedvoid onDestroy() { 

 if(popupOverlay !=null)

 {

 popupOverlay.hidePop();

 popupOverlay =null;

 }

  

 if(mLocClient !=null){

if(mLocClient.isStarted()){

mLocClient.stop();

}

mLocClient.unRegisterLocationListener(myListener);

mLocClient =null;

}


 if(mapView !=null){

mapView.destroy();  

mapView =null;

}

       if(manager!=null){  

       manager.destroy();  

       manager=null;  

        }  

       super.onDestroy();  

}  


原创粉丝点击