Issue
I have the following code, but the overlay doesn't seem to be visible on the map, although the focus is on the desired geo points. Here's the code:
public void setOverlay()
{
MapView mapView = (MapView)findViewById(R.id.mapview);
mapView.getController().setCenter(place.getGeoPoint());
List<Overlay> mapOverlays = mapView.getOverlays();
Drawable drawable = this.getResources().getDrawable(R.drawable.ic_launcher);
MyItemizedOverlay itemizedOverlay = new MyItemizedOverlay(drawable);
OverlayItem overlayitem = new OverlayItem(place.getGeoPoint(), "Hola, Mundo!", "I'm in Mexico City!");
itemizedOverlay.addOverlay(overlayitem);
mapOverlays.add(itemizedOverlay);
}
What could be the problem here?
Solution
You need to call:
mapView.invalidate();
To force the redraw of overlays after you add them to MapView
. Add the line above to the bottom of your method and it should work (I´m assuming that your icon is not fully transparent :-), in that case you will not see it in anyway)
Regards.
Answered By - Luis
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.