Android Question Polyline not draw - google maps - SOLVED

daniedb

Active Member
Licensed User
Longtime User
Hi Guys,
Spending 2 hours try to find this simple problem.
Loading various point from a Listview - work
add Markers to map - Work
Add Point but they don't draw a line
Please advice
Code:
         gmap = mFragment.GetMap
         gmap.AddMarker(coordlistlat.GetItem(0),coordlistlon.GetItem(0) , "Departure/Take Off "&routeplaningList.GetItem(0))
           Log("1-  gmap add marker "&coordlistlat.GetItem(0)&" , "&coordlistlon.GetItem(0))
         Dim line As Polyline
         Dim ppoints As List
         Dim Point As LatLng
         line=gmap.AddPolyline
         ppoints.Initialize

        line.color=Colors.Red 'Array As Int(255,255,255)
        line.Geodesic=True
        line.Visible =True
        line.Width=15
        line.Points.AddAll(ppoints)
         For i = 0 To routeplaningList.size -1
            Point.Initialize(coordlistlat.GetItem(i),coordlistlon.GetItem(i))
               ppoints.Add(Point)
           Log("Point.Initialize("&coordlistlat.GetItem(i)&" , "&coordlistlon.GetItem(i)&" ")
             gmap.AddMarker(coordlistlat.GetItem(i),coordlistlon.GetItem(i) , routeplaningList.GetItem(i))
       Next
               Log(ppoints.Size)
             Dim cp As CameraPosition
          cp.Initialize(coordlistlat.GetItem(0),coordlistlon.GetItem(0) , 12)
           Log ("1 - cp initialized  after gmap "&coordlistlat.GetItem(0)&" , "&coordlistlon.GetItem(0))
           gmap.AnimateCamera(cp)

THanks
D
 
it seems that your ppoints is empty when you add it to the line...you fill ppoints after adding to the polyline...may be that the reason??
 
Upvote 0
Yes eurojam, I forgot to add the ppoint after all the points has been populated/initialized
Stupid mistake that took me 2 hours to sort out... wasted time...
 
Upvote 0
Back
Top