tell me, how can I correctly catch a click on a certain marker on the Google Maps map and then set the action? Let's say there are three variables Marker One; Two; Three; I did so, but works only with the third-fourth click on the marker:
public void onMapReady(GoogleMap googleMap) {
...
One = mMap.addMarker(new MarkerOptions()
.position(lat));
One.setTag(0);
// Set a listener for marker click.
mMap.setOnMarkerClickListener(this);
}
public boolean onMarkerClick(final Marker marker) {
ExampleBottomSheetDialog bottomSheet = new ExampleBottomSheetDialog();
bottomSheet.show(getSupportFragmentManager(), "exampleBottomSheet");
// Check if a click count was set, then display the click count.
if (marker.equals(One)) {
Toast.makeText(getApplicationContext(), "Balalaika: ",
Toast.LENGTH_SHORT).show();
}
return false;
}