首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

google地图加载多个overlay内存溢出

2012-09-14 
googlemap加载多个overlay内存溢出今天测试了一下地图加载多个不同overlay,结果溢出 其实也不大16*16 总过

googlemap加载多个overlay内存溢出

今天测试了一下地图加载多个不同overlay,结果溢出 其实也不大16*16 总过18个

结果内存移除"out of memory".搜索了一下 有个人也遇到过 他的解决办法就是 捕获溢出的异常

mapView.setBuiltInZoomControls(true); ??
? ? ZoomButtonsController zoomctrl = mapView.getZoomButtonsController(); ?
? ? zoomctrl.setAutoDismissed(false);//自动隐藏关闭?
? ? zoomctrl.setVisible(true);?
? ? zoomctrl.setOnZoomListener(new ZoomButtonsController.OnZoomListener() {?
?
? ? ? ? public void onZoom(boolean zoomIn) {?
? ? ? ? ? ? // TODO Auto-generated method stub?
? ? ? ? ? ? try{?
? ? ? ? ? ? ? ? Log.i(TAG, "OnZoomListener");?
? ? ? ? ? ? ? ? System.gc();?
? ? ? ? ? ? ? ? if(zoomIn)?
? ? ? ? ? ? ? ? { ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? ? ? ? ? ? ? mc.zoomIn();?
? ? ? ? ? ? ? ? }?
? ? ? ? ? ? ? ? else?
? ? ? ? ? ? ? ? {?
? ? ? ? ? ? ? ? ? ? mc.zoomOut();?
? ? ? ? ? ? ? ? }?
? ? ? ? ? ? ? ? System.gc();?
? ? ? ? ? ? }?
? ? ? ? ? ? catch(OutOfMemoryError e)?
? ? ? ? ? ? {?
? ? ? ? ? ? ? ? e.printStackTrace();?
? ? ? ? ? ? ? ? Log.e(TAG, e.toString());?
? ? ? ? ? ? ? ? Toast.makeText(GoogleMap.this, e.toString(), Toast.LENGTH_LONG);?
? ? ? ? ? ? }?
? ? ? ? ? ? catch (Exception e)?
? ? ? ? ? ? {?
? ? ? ? ? ? ? ? Log.w(TAG, e.toString());?
? ? ? ? ? ? ? ? Toast.makeText(GoogleMap.this, e.toString(), Toast.LENGTH_LONG);?
? ? ? ? ? ? } ? ? ? ? ? ? ? ?
? ? ? ? }?
?
? ? ? ? public void onVisibilityChanged(boolean visible) {?
? ? ? ? ? ? // TODO Auto-generated method stub?
?
? ? ? ? }?
? ? });?
?
? ? private boolean myDoubleTouch(float x, float y, MapView mapView)?
? ? {?
? ? Log.i(mParent.TAG, "myDoubleTouch: " + x +","+y);?
? ? try?
? ? {?
? ? ? ? mapView.getController().zoomInFixing((int)x, (int)y);?
? ? }?
? ? catch(OutOfMemoryError e)?
? ? {?
? ? ? ? System.gc();?
? ? ? ? e.printStackTrace();?
? ? ? ? Log.e(mParent.TAG, e.toString());?
? ? ? ? Toast.makeText(m_mapview.getContext(), e.toString(), Toast.LENGTH_LONG);?
? ? }?
? ? catch (Exception e)?
? ? {?
? ? ? ? Log.w(mParent.TAG, e.toString());?
? ? ? ? Toast.makeText(m_mapview.getContext(), e.toString(), Toast.LENGTH_LONG);?
? ? } ? ? ? ? ? ?
?
? ? return true;?
}?

1 楼 llxwxj 2011-09-19   没头没尾的。。。mc是什么?

热点排行