Hi, this is my first program with B4A and i think it is great. I followed the google map tutorial and now i have it running in my device without problems. Now i would like to draw a polygon when the user click over the map. How can i do this? Thanks
Sub DrawPolygon (PointList As List)
Dim GoogleMapsExtras1 As GoogleMapsExtras
Dim polygonoptions1 As PolygonOptions
polygonoptions1.Initialize
polygonoptions1.FillColor=Colors.ARGB(150,255,255,0)
polygonoptions1.AddPoints(PointList)
polygonoptions1.StrokeColor=Colors.DarkGray
polygonoptions1.StrokeWidth=3
Dim pg As Polygon = GoogleMapsExtras1.AddPolygon(gmap, polygonoptions1)
End Sub
The Pointlist is a List containing objects of the type LatLng. You can collect them for example from the click event on the mapfraqment.
B4X:
Sub MapFragment1_LongClick (mPoint As LatLng)
...'put the latLng into a list
end sub
Hi, thanks for your answer, i advance a lot in my program, but i still cant draw polygons.
Here:
Dim GoogleMapsExtras1 AsGoogleMapsExtras
Dim polygonoptions1 AsPolygonOptions