Android Question Add the List of Markers

T201016

Active Member
Licensed User
Longtime User
Hi.
How can I modify the code line to add all markers? The following example allows me ONLY to initialize the LAST marker to MarkersOverlay.

Thank you in advance for your ideas.

B4X:
'    create a List and initialize it with the 2 Markers
        Dim Markers As List
        Dim Marker1 As Marker
       
       

        For i = 0 To eLoadImages.Size -1
            ChosenName = eLoadImages.Get(i)
            OverlayMapPhoto.exif.Initialize(eFilePath, ChosenName)

            Dim Lt,Lg As String
            Lt = TM.MeGeo(OverlayMapPhoto.exif.getAttribute(OverlayMapPhoto.exif.TAG_GPS_LATITUDE),0)
            Lg = TM.MeGeo(OverlayMapPhoto.exif.getAttribute(OverlayMapPhoto.exif.TAG_GPS_LONGITUDE),0)
           
            If Lt.Length > 0 And Lg.Length > 0 Then
                Marker1.Initialize(i, ChosenName, Lt, Lg, ic_touch)
                Markers.Initialize2(Array As Object(Marker1))
            End If
        Next
        '    add the List of Markers to the MarkersOverlay
        MarkersOverlay1.AddMarkers(Markers)
        Markers.Clear
 

Alexander Stolte

Expert
Licensed User
Longtime User
...by writing this line "MarkersOverlay1.AddMarkers(Markers)" before the Next.

B4X:
'    create a List and initialize it with the 2 Markers
        Dim Markers As List
        Dim Marker1 As Marker
   
   

        For i = 0 To eLoadImages.Size -1
            ChosenName = eLoadImages.Get(i)
            OverlayMapPhoto.exif.Initialize(eFilePath, ChosenName)

            Dim Lt,Lg As String
            Lt = TM.MeGeo(OverlayMapPhoto.exif.getAttribute(OverlayMapPhoto.exif.TAG_GPS_LATITUDE),0)
            Lg = TM.MeGeo(OverlayMapPhoto.exif.getAttribute(OverlayMapPhoto.exif.TAG_GPS_LONGITUDE),0)
       
            If Lt.Length > 0 And Lg.Length > 0 Then
                Marker1.Initialize(i, ChosenName, Lt, Lg, ic_touch)
                Markers.Initialize2(Array As Object(Marker1))
            End If

'    add the List of Markers to the MarkersOverlay
        MarkersOverlay1.AddMarkers(Markers)
Markers.Clear
        Next
 
Upvote 0

T201016

Active Member
Licensed User
Longtime User
I thought that Markers.Initialize2 (Array As Object (Marker1)) automatically adds all the initialized markers ...

Thank you very much!
 
Upvote 0
Top