private void AddNetwork(object sender, EventArgs e) { Android.Support.V7.App.AlertDialog.Builder alertDialog = new Android.Support.V7.App.AlertDialog.Builder(Activity); var localView = Activity.LayoutInflater.Inflate(Resource.Layout.MainDialog, null); alertDialog.SetView(localView); alertDialog.SetTitle("Add new network"); var name = localView.FindViewById <TextInputEditText>(Resource.Id.textInputEditText1); var button = localView.FindViewById <Button>(Resource.Id.changeLocationButton); coords = new GeoCoords(45, 45); view = localView; button.Click += OnPickAPlaceButtonTapped; alertDialog.SetNeutralButton("OK", async delegate { if (name.Text != String.Empty) { await adapter.AddNetwork(name.Text, coords); } alertDialog.Dispose(); }); alertDialog.SetNegativeButton("Cancel", delegate { alertDialog.Dispose(); }); alertDialog.Show(); }