views:

29

answers:

0

I followed the HelloMapView tutorial, and I extended it so that I can add more OverlayItems to the map with a button, as well as some load / save functionality. All of this works correctly, except for adding a new OverlayItem. All of the OverlayItems added when the application loads a drawn fine, but when I add a new one to the ItemizedOverlay while the application is running, the icon is not drawn until the map is moved. Is there a function call or something that I'm missing?

Here is my code for adding the new OverlayItem:

protected void saveCurrentLocation() {
    GeoPoint point = mapView.getMapCenter();
    String title = (String) getText(R.string.default_title), 
        message = (String) getText(R.string.default_message);
    OverlayItem overlay = new OverlayItem(point, title, message);

    itemizedoverlay.addOverlay(overlay);

    // More stuff here that isn't relevant
}