var dialogBuilder = new AlertDialog.Builder(this); dialogBuilder.SetTitle("Title"); dialogBuilder.SetMessage("Message"); dialogBuilder.SetPositiveButton("OK", (senderAlert, args) => { }); var dialog = dialogBuilder.Create(); dialog.Show();
var dialogBuilder = new AlertDialog.Builder(this); dialogBuilder.SetTitle("Choose an Option"); dialogBuilder.SetMessage("Please select an option below:"); dialogBuilder.SetCancelable(true); dialogBuilder.SetPositiveButton("Option A", (senderAlert, args) => { }); dialogBuilder.SetNegativeButton("Option B", (senderAlert, args) => { }); var dialog = dialogBuilder.Create(); dialog.Show();In this example, a new Alert Dialog is created and displayed with a title, message and two buttons ("Option A" and "Option B"). The dialog is also set as cancelable, meaning it can be closed by the user pressing outside the dialog. When either button is clicked, a message is not displayed, but the `OnClick` event is handled. Both of these examples use the `AlertDialog.Builder` class and the `SetMessage` method to create an Alert Dialog with a message to be displayed. The package library used is the `Android.App` library.