This method allows to set a custom style to the map.
Step 1: Create the style with the wizard and save the json string in a file: https://mapstyle.withgoogle.com/
Step 2: Set the style after the map is ready:
B4X:
SetMapStyle(File.ReadString(File.DirAssets, "style.txt"))
Code:
B4X:
Sub SetMapStyle(style As String)
Dim jo As JavaObject = gmap
jo = jo.GetField("map")
jo.GetFieldJO("jsObject").RunMethod("eval", Array($"
this.setOptions({
styles:
${style}
});
"$))
End Sub
Last edited: