Event when you click on a Google Maps marker

3

I would like to know if you can put event in Google Maps bookmarks to open a custom information window, such as a fragment, for example.

    
asked by anonymous 30.05.2018 / 04:41

1 answer

4

Use the setOnMarkerClickListener() method of the map to "set" a OnMarkerClickListener that will have its onMarkerClick() method called when the user clicks on it.

GoogleMap googleMap;
googleMap.setOnMarkerClickListener(new GoogleMap.OnMarkerClickListener() {
    @Override
    public boolean onMarkerClick(Marker marker) {

    }

The object received in the parameter marker is the Marker clicked.

See Marker click events in the documentation.

    
30.05.2018 / 14:13