Triggering a map event (like a marker click) in Google maps Android V2

android, google-maps, google-maps-android-api-2, google-maps-markers

Solution

You cannot triger a marker click directly.

If you need to run default implementation when onMarkerClick returns false (or you have no OnMarkerClickListener), you need to do it yourself:

marker.showInfoWindow();
map.animateCamera(CameraUpdateFactory.newLatLng(marker.getPosition()), 250, null);

250 is assumed here, API doesn't give you the value used internally for this default marker click behaviour.

If you have a OnMarkerClickListener, you can just keep the reference and call a function on it sending marker as a param.

Problem

I am trying to trigger a marker click (or other map events too) programmatically in Google maps API for android V2. Does anyone have an idea as to how to do it ? Apparently javascript api (v3) , has a trigger function but I could'nt find anything for android. Thanks for the help.

Original source

Related problems