Xamarin.Android Dismiss SetSingleChoiceItems on DialogClickEventArgs handler

If you are ever working on a Xamarin.Android App and need to dismiss an AlertDialog box when loading SingleChoiceItems here’s an easy way to achieve it.

In the example below we create a new DialogBuilder instance, adding a title and then loading several items as SingleChoiceItems. Then on the DialogClickEventArgs handler grab a reference to the AlertDialog var d; and simply call d.Dismiss() to dismiss dialog, removing it from the screen.

Principal Software Engineer at Command Health https://github.com/dannycabrera

Principal Software Engineer at Command Health https://github.com/dannycabrera