iOS Question Create a List of latitude and longitude

Humberto

Active Member
Licensed User
Longtime User
I´m retrieving from a database points saved to create a list and then set a polyline in google maps

B4X:
    Dim xLatLong As LatLng
    xList.Initialize
    Do While xCursor.NextRow
        xLatLong.Initialize ( xCursor.GetString ( "latitude" ), xCursor.GetString ( "longitude" ) )
        xList.Add ( xLatLong )
    Loop
    xCursor.Close

I initialize each time the "xlatLong" but the "xList" itens contain the last value inserted
 

klaus

Expert
Licensed User
Longtime User
This should work:
B4X:
xList.Initialize
Do While xCursor.NextRow
    Dim xLatLong As LatLng
    xLatLong.Initialize ( xCursor.GetString ( "latitude" ), xCursor.GetString ( "longitude" ) )
    xList.Add ( xLatLong )
Loop
xCursor.Close
You mst move Dim xLatLong AsLatLng inside the loop.
 
Upvote 0
Top