I am integrating the Google Maps API Android v2 into my application and weird marker behavior in GoogleMap. OnMarkerClickListener # onMarkerClick (marker marker) is not called after hiding InfoWindow. It doesnโt depend on how I show InfoWindow (neither marker.showInfoWindow () nor
@Override public boolean onMarkerClick(final Marker marker) { ..... return true;}
does not work. After I changed the position of the camera by touching or zooming, it works once. I saw the same behavior in GoogleMapDemo.
Here is my code
private GoogleMap mMap; @Override protected void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.map_address_activity); setUpMapIfNeeded(); // from oficial sample mMap.setOnMapClickListener(new OnMapClickListener() { @Override public void onMapClick(LatLng point) { mMap.clear(); mMap.addMarker(new MarkerOptions().position(point).title("Marker")); final CameraPosition cameraPosition = new CameraPosition.Builder().target(point).zoom(mMap.getCameraPosition().zoom).build(); mMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition)); }); mMap.setOnMarkerClickListener(new OnMarkerClickListener() { @Override public boolean onMarkerClick(final Marker marker) { Log.e("TESTING", "on Marker click: " + marker.getTitle()); if (!marker.isInfoWindowShown()) marker.showInfoWindow(); else marker.hideInfoWindow(); return true; } }); }
Can you help me handle click events on the marker after hiding InfoWindow?
source share