AlertDialog not disappearing when alert.Dispose() is called

SvetoslavHlebarovSvetoslavHlebarov ✭✭USMember ✭✭
edited January 2018 in Xamarin.Android

I declare AlertDialog:

AlertDialog.Builder alertConfirmTransfer = new AlertDialog.Builder(this);
alertConfirmTransfer.SetMessage("Some message");
alertConfirmTransfer.SetPositiveButton("YES", delegate
{
    alertConfirmTransfer.Dispose();
});
alertConfirmTransfer.SetNegativeButton("NO", delegate
{
    alertConfirmTransfer.Dispose();
});

Dialog dialogConfirmTransfer = alertConfirmTransfer.Create();
dialogConfirmTransfer.Show();

When the dialog appears and I click yes or no the dialog disappears but if in the SetPositiveButton I put a try-catch block under

alertConfirmTransfer.Dispose();

and the try'catch slows down when I click Yes button, the dialog stays on screen

Sign In or Register to comment.