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.
For adding a custom marker to Google Maps navigate to the app > res > drawable > Right-Click on it > New > Vector Assets and select the icon which we have to show on your Map. You can change the color according to our requirements. After creating this icon now we will move towards adding this marker to our Map.
To add an event, head to Google Maps on Android, tap on Contribute >Events > Add a public event. You can add an event name, tag the location, and add the time and date of the event as well. There's an option to add an image, write more event details, and add description as well.
Google Maps allows you to customize maps by adding markers manually or as a group.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With