0
我正在開發自定義地圖我可以從webservices獲取數據並基於該數據顯示覆蓋項目的應用程序。這是我運行我的應用程序時出現的問題,它會正確顯示地圖和覆蓋圖,但是當我嘗試縮放它或嘗試點擊它時,它會變慢,性能很慢。所以這裏有一些性能問題。事實上,它不包含很多數據,只有50個覆蓋。Android MapView中的性能問題
我懷疑添加物品重疊有什麼問題,請檢查並幫助我。
代碼:
private void showWhaleDophinSightingsToMap() {
mapOverlays = mapView.getOverlays();
progressDialog.dismiss();
// Show overlay for whale sightings
Log.i(TAG, "whaleWatchingInfoList >>>>>> " + whaleWatchingInfoList);
Log.i(TAG, "whaleWatchingInfoList >>>>>> "+ whaleWatchingInfoList.size());
if(whaleWatchingInfoList != null && whaleWatchingInfoList.size() > 0) {
drawable = getResources().getDrawable(R.drawable.north);
customItemizedOverlay = new CustomItemizedOverlay<CustomOverlayItem>(drawable, mapView);
for(int i = 0; i < whaleWatchingInfoList.size(); i++) {
if(i == 0) {
MapController mc = mapView.getController();
mc.setZoom(7);
// Zoom Level
mapView.getController().setCenter(new GeoPoint((int)(whaleWatchingInfoList.get(i).getLatitude() * 1E6),
(int)(whaleWatchingInfoList.get(i).getLongtitude() * 1E6)));
}else {
geoPoint = new GeoPoint((int)(whaleWatchingInfoList.get(i).getLatitude() * 1E6),
(int)(whaleWatchingInfoList.get(i).getLongtitude() * 1E6));
CustomOverlayItem customOverlayItem = new CustomOverlayItem(geoPoint, whaleWatchingInfoList.get(i).getName(), whaleWatchingInfoList.get(i).getDescription(), whaleWatchingInfoList.get(i).getImageUrl(), whaleWatchingInfoList.get(i).getAtdwProductUrl());
customItemizedOverlay.addOverlay(customOverlayItem);
mapOverlays.add(customItemizedOverlay);
}
}
}
mapView.postInvalidate();
}