In the jGoogleMaps V2.00 example, you can create an info window programmatically when a marker is clicked using the following sub:
B4X:
Private Sub ShowInfoWindow (Marker As Marker, Map As GoogleMap)
If MarkerInfos.ContainsKey(Marker) Then
Dim info As JavaObject = MarkerInfos.Get(Marker)
Dim jMap As JavaObject = Map
jMap = jMap.GetField("map")
info.RunMethod("open", Array (jMap, Marker))
End If
End Sub
To clear (delete/remove/hide) the info window you have to click on the "X" displayed in the window.
How can you do this programmatically, without having to click the "X" or having to delete the marker ?
Thanks! I knew it had to be something simple but not being familiar with JavaObject, I couldn't figure out the exact syntax.
Here's the complete sub:
B4X:
Private Sub CloseInfoWindow (Marker As Marker, Map As GoogleMap)
If MarkerInfos.ContainsKey(Marker) Then
Dim info As JavaObject = MarkerInfos.Get(Marker)
Dim jMap As JavaObject = Map
jMap = jMap.GetField("map")
info.RunMethod("close", Null)
End If
End Sub
Private Sub CloseInfoWindow (Marker As Marker, Map As GoogleMap)
If MarkerInfos.ContainsKey(Marker) Then
Dim info As JavaObject = MarkerInfos.Get(Marker)
info.RunMethod("close", Null)
End If
End Sub
Private Sub CloseInfoWindow (Marker As Marker, Map As GoogleMap)
If MarkerInfos.ContainsKey(Marker) Then
Dim info As JavaObject = MarkerInfos.Get(Marker)
info.RunMethod("close", Null)
End If
End Sub