Android Question GoogleMaps - Marker InfoWindow LongClick

Erel

B4X founder
Staff member
Licensed User
Longtime User
Here:
B4X:
Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("1")
   Wait For MapFragment1_Ready
   gmap = MapFragment1.GetMap
   If gmap.IsInitialized Then
     Dim jo As JavaObject = gmap
     Dim event As Object = jo.CreateEventFromUI("com.google.android.gms.maps.GoogleMap.OnInfoWindowLongClickListener", _
       "InfoWindowLongClick", Null)
     jo.RunMethod("setOnInfoWindowLongClickListener", Array(event))
     
     gmap.AddMarker(30, 30, "Testing 1, 2, 3")
   End If
End Sub

Sub InfoWindowLongClick_Event (MethodName As String, Args() As Object) As Object
   Dim m As Marker = Args(0)
   Log($"Marker: ${m.Title} was long clicked"$)
   Return Null
End Sub
 
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
Here:
B4X:
Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("1")
   Wait For MapFragment1_Ready
   gmap = MapFragment1.GetMap
   If gmap.IsInitialized Then
     Dim jo As JavaObject = gmap
     Dim event As Object = jo.CreateEventFromUI("com.google.android.gms.maps.GoogleMap.OnInfoWindowLongClickListener", _
       "InfoWindowLongClick", Null)
     jo.RunMethod("setOnInfoWindowLongClickListener", Array(event))
    
     gmap.AddMarker(30, 30, "Testing 1, 2, 3")
   End If
End Sub

Sub InfoWindowLongClick_Event (MethodName As String, Args() As Object) As Object
   Dim m As Marker = Args(0)
   Log($"Marker: ${m.Title} was long clicked"$)
   Return Null
End Sub

Thanks Erel! I was wondering if something like that would be possible, but wasn't sure how to go about it.

- Colin.
 
Upvote 0
Top