forsaken_3479
forsaken_3479

Reputation: 1124

Removing marker from google maps

So I want to remove the marker ween it is clicked. I am using this code but nothing happens.

public boolean onMarkerClick(final Marker marker) {
    marker.remove();
    return true;
}

What am I doing wrong?

Upvotes: 0

Views: 74

Answers (1)

Decoy
Decoy

Reputation: 1597

Just tested and the remove() works..

map.setOnMarkerClickListener(new OnMarkerClickListener(){
    @Override
    public boolean onMarkerClick(Marker marker) {
        marker.remove();
        return true;
    }
});

Upvotes: 2

Related Questions