why the SketchEditor always is null in xamarin.Android

2274
2
Jump to solution
04-11-2017 08:16 AM
xipeng
by
New Contributor III

I want to draw polyline use SketchEditor in Android, but this SketchEditor always is null,why?

my code as follow:

btnEdit = FindViewById<Button>(Resource.Id.button1);
btnEdit.Click += (s, e) => {
try
{
SketchEditor se = new SketchEditor();
this._mapView.SketchEditor = se;
this._mapView.SketchEditor.StartAsync(SketchCreationMode.Polyline);
}
catch(Exception ex)
{
}

Really looking forward to answer 

thanks

0 Kudos
1 Solution

Accepted Solutions
PreetiMaske
Esri Contributor

We are aware of this issue. This bug is already logged in our bug tracking system. We will try to get this fixed in upcoming release in summer. At this point , the workaround would be to create the layout in the activity and add the MapView from within the activity.

 protected override void OnCreate(Bundle bundle)
{
 base.OnCreate(bundle);
 layout = new LinearLayout(this) { Orientation = Orientation.Vertical };
 new MapView();
 Map = new Map(Basemap.CreateImagery());

 ButtonStart = new Button(this);
 Text = "Start";
 Click += BtnClickAsync;

 AddView(ButtonStart);
 AddView(_mapView);
 layout);
}

View solution in original post

0 Kudos
2 Replies
PreetiMaske
Esri Contributor

We are aware of this issue. This bug is already logged in our bug tracking system. We will try to get this fixed in upcoming release in summer. At this point , the workaround would be to create the layout in the activity and add the MapView from within the activity.

 protected override void OnCreate(Bundle bundle)
{
 base.OnCreate(bundle);
 layout = new LinearLayout(this) { Orientation = Orientation.Vertical };
 new MapView();
 Map = new Map(Basemap.CreateImagery());

 ButtonStart = new Button(this);
 Text = "Start";
 Click += BtnClickAsync;

 AddView(ButtonStart);
 AddView(_mapView);
 layout);
}
0 Kudos
xipeng
by
New Contributor III

 

thanks for your answer, expect to fix the bug at early date

0 Kudos