Android Question How to create line/polygon on map ?

Sapta

Member
Licensed User
Longtime User
Hi,
My project this time wants to make measurement of distance and history when I do run / walk in the garden.

If I measure the distance I find this
B4X:
Distance = Location1.DistanceTo(Location2)

However, how can I make my travel and running history illustrated on google map with line or polygon on google map extra?

like blue line bellow
thank you

jiuDs.png
 

Sapta

Member
Licensed User
Longtime User
@Erel , Do you have an example code?

I try with this, it still does not work :(
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
    Dim Latnya, Longnya As Double
End Sub

Sub BtnTestBaruJarakFinish_Click
    Dim l1 As LatLng

    Dim Points As List
    Points.Initialize
    l1.Initialize(Latnya, Longnya)
    Points.Add(l1)

    Dim pl As Polyline = gmap.AddPolyline
    pl.points = Points
    pl.Color=Colors.blue
    pl.ZIndex=3

    ToastMessageShow("ss",False)
End Sub

Public Sub LocationChanged(Location1 As Location)
    Latnya = Location1.Latitude
    Longnya = Location1.Longitude
End Sub
 
Last edited:
Upvote 0
Top