Sharmilee
Sharmilee

Reputation: 1295

Enhance Performance of mapview with 200+ markers

I am having 3 types of overlays on the map. 1) there is one kind of overlays which is having simple markers. And on click of overlay i show pop up. 2) other kind of overlay contains canvas drawing. and onTouch event of these overlays we have to show third kind of overlay which contains bitmap drawing on the map. And click event of third kind of overlay is also there.

so, due to heavy calculations and lots of canvas drawing, performance of mapview is degraded.

I have gone through Overlaymanager libreary from https://github.com/staroud-android/OverlayManager. but its not helping me.

Is there any way which can fulfill my requirements with high performance?

I also need suggestion that Polaris map library can help me for better performance? https://github.com/cyrilmottier/Polaris

Upvotes: 0

Views: 426

Answers (1)

SquiresSquire
SquiresSquire

Reputation: 2414

What is happening is that you are populating the MapView everytime you add a GeoPoint. Try adding this to your code:

after you have looped through the GeoPoints place this code

itemizedOverlay.populateNow();

and change you itemizedOverlay to look like this:

public void addOverlay(OverlayItem overlay) {
    m_overlays.add(overlay);
        }
public void populateNow()
{
    populate(); 
}

@Override
protected OverlayItem createItem(int i) {
    return m_overlays.get(i);
}

@Override
public int size() {
    return m_overlays.size();
}

Upvotes: 1

Related Questions