Android google maps marker disable navigation option

AndroidGoogle Maps-MarkersGoogle Maps-Android-Api-2Android Maps-V2

Android Problem Overview


Im creating an app where users need to walk to a point on a map. But they need to find a route to the point by them selves. Ive created a map with markers but by default if a user clicks on the marker a "start navigation" and "view in google maps" option is shown. Is it possible to disable these options ?

The options that are shown on marker click

The options that are shown on marker click

Android Solutions


Solution 1 - Android

This thing is called Map Toolbar. You can disable it by calling UiSettings.setMapToolbarEnabled(false):

GoogleMap map;
....... //init map

map.getUiSettings().setMapToolbarEnabled(false);

Solution 2 - Android

You can also define setMapToolbarEnabled() from the XML using the following property:

map:uiMapToolbar="false"

Solution 3 - Android

In kotlin you can do:

map.apply {
   uiSettings.isMapToolbarEnabled = false
}

Solution 4 - Android

If anyone needs to do this in Google Maps v2, you set it in the map options instead of setting it on the map directly. So like this:

var mapOptions = new GoogleMapOptions().InvokeMapToolbarEnabled(false);

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSven van den BoogaartView Question on Stackoverflow
Solution 1 - AndroidPavel DudkaView Answer on Stackoverflow
Solution 2 - AndroidGnzltView Answer on Stackoverflow
Solution 3 - AndroidNicola GallazziView Answer on Stackoverflow
Solution 4 - AndroidØyvind BråthenView Answer on Stackoverflow