Android Question Marker Click

imbault

Well-Known Member
Licensed User
Longtime User
Hi

How to know if the label is currently displayed or not when the MarkerClick event is clicked ?

Erel gaves this code snippet for B4i, I just would like the equivalent on Android, please
B4X:
Sub gmap_MarkerClick (SelectedMarker As Marker) As Boolean
   Dim ngm As NativeObject = gmap
   Dim infoWindowVisible As Boolean = True
   If ngm.GetField("selectedMarker").IsInitialized Then
     Dim current As Marker = ngm.GetField("selectedMarker")
     If current.Title = SelectedMarker.Title Then infoWindowVisible = False
   End If
   If infoWindowVisible Then
     Log("Snippet is shown")
   Else
     Log("Snippet is hidden")
   End If
   Return False
End Sub
 

DonManfred

Expert
Licensed User
Longtime User
B4X:
 SelectedMarker.Visible
?
 
Upvote 0

imbault

Well-Known Member
Licensed User
Longtime User
Thanks Manfred, but SelectedMarker.Visible is not enough, I need to be able to know if Label Marker has been clicked...
 
Upvote 0

svenjamin

New Member
Licensed User
Hi! I'm really new to B4A and just trying out some things with Maps and I wanted to do the same thing as imbault. I can't really get it working with the InfoWindowShown member.

Here's a little Snippet:
B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Private gmap As GoogleMap
    Private MapFragment1 As MapFragment

End Sub

Sub MapFragment1_MarkerClick( SelectedMarker As Marker ) As Boolean
    If SelectedMarker.InfoWindowShown = True Then
        ToastMessageShow( "Label shown", False )
    Else
        ToastMessageShow( "Label not shown", False )
    End If
    Return False
End Sub

Sub MapFragment1_Ready
    gmap = MapFragment1.GetMap
    Public m1 As Marker
    m1 = gmap.AddMarker(5,  5, "MARKER")
    m1.Snippet = "More Infos"
End Sub

Only "Label not shown" is returned, not depending if the "MARKER More Infos" Label is shown or not. Am I using something wrong here?
 
Upvote 0
Top