AlertDialog doesn't show at .show()

I have the following code:

private void CloseOrder(object sender, EventArgs e)
            Android.Support.V7.App.AlertDialog.Builder alert = new Android.Support.V7.App.AlertDialog.Builder(this);

            alert.SetTitle("Cerrar Pedido");
            alert.SetMessage("Are you sure?");
            alert.SetPositiveButton("Confirm", delegate { this.Rta = true; });
            alert.SetNegativeButton("Cancel", delegate { this.Rta = false; });
            Dialog dialog = alert.Create();

            if (this.Rta)
                //Some code here


this.Rta is a property of my class.

The problem is that the alert doesn't show at "", it shows once the method "CloseOrder()" ended, so this.Rta never gets the corresponding value assigned.

I've been searching a lot but I can't find a solution, if anyone can help me that'd be great!


Sign In or Register to comment.