Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show directions button in Google Map when Info Window opened programmatically

I have a map in my android application with several markers. When I click on any of the markers the info window appears and also a directions button on the bottom right hand side corner just like the picture below shows.

Google Maps

The problem is that I also open the info window programmatically based on user inputs within the app. I do this using marker.showInfoWindow() but this way it doesn't show the directions button. I have googled around and not found anyone with a similar issue, was hoping there was a way for the button to appear and if so how?

like image 270
Daniel Julio Avatar asked May 28 '15 15:05

Daniel Julio


People also ask

How do I open the information window in Google Maps?

Show activity on this post. The following example shows a simple Marker (standard icon) on Google maps for the location and when clicking the icon, it opens the info window.

How do I add an event to Google Maps?

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.


1 Answers

You need to do as follows:

GoogleMap myMap;
myMap.getUiSettings().setMapToolbarEnabled(true);

You can get all sample project code on my github here and try yourself:) Just long click on map to set up a marker, click it, show the infoWindow, and finally, it will show the button.

enter image description here

like image 135
bjiang Avatar answered Sep 28 '22 09:09

bjiang