max
max

Reputation: 6187

Marker not showing in osmdroid

I want to add a draggable marker to osmdroid. for that I use this code

    import org.osmdroid.views.overlay.Marker;

    Marker marker=new Marker(mapView);
    marker.setPosition(new GeoPoint(36.607007, 59.133225));
    marker.setIcon(drawable);
    marker.setImage(drawable);
    marker.setTitle("dddd");  
    marker.showInfoWindow();

it dosent show my icon in mapview but just show info window.
can anyone help me about that?

Upvotes: 1

Views: 2062

Answers (1)

Priyank Patel
Priyank Patel

Reputation: 12362

You need to add marker to Overlays and invalidate your mapView.

Try with adding marker to Map Overlays and calling mapView.invalidate() like below.

Marker marker=new Marker(mapView);
marker.setPosition(new GeoPoint(36.607007, 59.133225));
marker.setIcon(drawable);
marker.setImage(drawable);
marker.setTitle("dddd");  
marker.showInfoWindow();
mapView.getOverlays().add(marker);
mapView.invalidate();

Upvotes: 8

Related Questions