Android Question OSMDroid Polyline change on LocationChanged

sigster

Active Member
Licensed User
Longtime User
Hi

Are anyone who know how I can change Polyline Point on LocationChanged
if I do it like this and move the map the polyline change from the my Location sometime it get longer and sometime it get shorter


B4X:
Public Sub LocationChanged(Location1 As Location)
'    lblLat.Text = "Lat = " & Location1.ConvertToMinutes(Location1.Latitude)
'    lblLon.Text = "Lon = " & Location1.ConvertToMinutes(Location1.Longitude)
'    lblSpeed.Text = $"Speed = $1.2{Location1.Speed} m/s "$
    
    RouteOverlay.Items.Clear
    Dim gp,gp2 As GeoPoint
    gp.Initialize(X, Y)
    gp2.Initialize(Location1.Latitude, Location1.Longitude)
    
    Dim RoutePoly As Polyline
    RoutePoly.Initialize(MapView1)
    RoutePoly.OutlinePaint.SetColor(Colors.Red).SetAlpha(255)
    RoutePoly.AddPoint(gp)
    RoutePoly.AddPoint(gp2)
    RouteOverlay.Items.Add(RoutePoly)
    'MapView1.GetMapCenter2(gp2)
    
    MapView1.MapController.AnimateTo3(gp2)
    
End Sub
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…