Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Make the marker as unclickable

Hi I'm creating the marker like

Marker thisUserMarker = map.addMarker(new MarkerOptions()
           .position(new LatLng(CURRENT_LAT, CURRENT_LNG))
           .icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_marker_current_location)));

after this i want to make the marker as unclickable, according to the CURRENT_LAT and CURRENT_LNG. Is it possible to do that

like image 587
Bahu Avatar asked Dec 08 '25 10:12

Bahu


1 Answers

I used this workaround, return true when you click on a marker

getMap().setOnMarkerClickListener(new OnMarkerClickListener() {

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

Other posibility could be implement implements OnMarkerClickListener and in your onMarkerClick() compare it with the marker that you don't want to be clickable and do nothing.

@Override
public boolean onMarkerClick(final Marker marker) {

    if (marker.equals(myMarker)) 
    {
        //Do nothing
    }
}

You can also check this question : google-maps-api-v2-how-to-make-markers-clickable

like image 175
Skizo-ozᴉʞS Avatar answered Dec 09 '25 23:12

Skizo-ozᴉʞS