Android Map Performance poor because of many Overlays?
Posted
by Dave
on Stack Overflow
See other posts from Stack Overflow
or by Dave
Published on 2010-04-17T19:49:33Z
Indexed on
2010/04/17
19:53 UTC
Read the original article
Hit count: 595
Hi,
I have a map in my android application that shows many markers (~20-50). But the app performs very poor when i try to scroll/zoom (in Google Android Maps i did a sample search for pizza and there were also some 20-50 results found and i didn't notice any particular performance problems when zooming/scrolling through the map).
Here is my (pseudo)code:
onCreate() {
....
drawable = this.getResources().getDrawable(R.drawable.marker1);
itemizedOverlay = new MyItemizedOverlay(drawable,mapView);
...
callWebServiceToRetrieveData();
createMarkers();
}
createMarkers(){
for(elem:bigList){
GeoPoint geoPoint = new GeoPoint((int)(elem.getLat()*1000000), (int) (elem.getLon()*1000000));
OverlayItem overlayItem = new OverlayItem(geoPoint, elem.getName(), elem.getData());
itemizedOverlay.addOverlay(overlayItem);
mapOverlays.add(itemizedOverlay);
}
mapView.invalidate();
}
the MyItemizedOverlay.addOverlay looks like this:
public void addOverlay(OverlayItem overlay) {
m_overlays.add(overlay);
populate();
}
© Stack Overflow or respective owner