Pascal Pascal - 3 months ago 46
Android Question

How to use Maps.TMapCircle in Delphi 10 for Android?

i want to add some

TmapCircle
to my
TMapView
for a Android App. Adding
Marker
works fine. Only
Circles
are not working.
Here is my Code:

uses
system.SysUtils, System.Types, System.UITypes, System.Classes,
System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
FMX.TabControl, FMX.StdCtrls, FMX.Controls.Presentation,
FMX.Gestures, System.Actions, FMX.ActnList, FMX.Maps, System.Sensors,
System.Sensors.Components, IdBaseComponent, IdIntercept,System.IOUtils,
IdBlockCipherIntercept, Data.FMTBcd, Data.DB, Data.SqlExpr,
Data.DbxSqlite, System.Generics.Collections;
...
..
.
private
{ Private declarations }
FMarkers : TList<TMapMarker>;
FCircles : TList<TMapCircle>;
...
..
.
implementation
var
MyMarker : TMapMarkerDescriptor;
MyCircle : TMapCircleDescriptor;
...
..
.

procedure TTabbedwithNavigationForm.Button1Click(Sender: TObject);
var
Position: TMapCoordinate;
begin

position.Latitude := mapview1.Location.Latitude;
position.Longitude := mapview1.Location.Longitude;

MyMarker := TMapMarkerDescriptor.Create(Position, 'MyMarker');
MyMarker.Draggable := True;
MyMarker.Visible :=True;
Fmarkers.Add(MapView1.AddMarker(MyMarker));


MyCircle := TMapCircleDescriptor.Create(Position, 190);
Mycircle.StrokeWidth := 3;
FCircles.Add(MapView1.AddCircle(MyCircle));
end;


Fmarkers
works fine. But
Fcircles
gives me a Error:


Segmentation Fault 11


in this line:

FCircles.Add(MapView1.AddCircle(MyCircle));


I don't understand why.

I am using Rad Studio 10.

Answer

You omit relevant parts of your source code. Please post a complete example.

However, I think your initialization code (which you omit) is broken. Most likely, you forgot to create FCircles. Thus, an access violation occures which is indicated by the error message "Segmentation Fault 11".