I have a mapview in my application. And I have to show more than 1,000 overlays on a map. And I have a list which is containing these places. So, do I have to create 1,000 overlay objects by iterating over the items in the list? And can anyone give me an efficient way to do this?
The way the Sanket is doing it the points are populated after every single point is added, this tends to lag out. A more effiecent way can be done like this:
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();
}