Hello friends.

Hello friends.
I am with a problem when i try to make a Polyline in mapview.
Here is the code:
var
Descr : TMapPolylineDescriptor;
lati, longe : integer;
Mapcoords : TArray;

begin
mapCoords[0].Latitude := 0.1;
mapCoords[0].Longitude := 0.1;
mapCoords[1].Latitude := 0.5;
mapCoords[1].Longitude := 0.5;

Descr := TMapPolylineDescriptor.Create(Mapview1.Location);
Mapview1.AddPolyline(Descr);
end;


When i try to exec it returns "Access violation"
I am using Delphi XE8 and the app is for android.


Thank you in advance

Comments

  1. Have you set the length of the mapCoords array?  Eg, SetLength(mapCoords, 2)?  You'll need to do that before accessing the elements - a TArray in Delphi doesn't auto-extend itself when an element that doesn't exist is accessed.

    ReplyDelete
  2. David Millington, thank you! I really made this mistake, shame on me! but now it solved. =)

    ReplyDelete
  3. david david est No worries, glad to help :)

    ReplyDelete

Post a Comment