I have created an Alert Popup that asks the user whether they want to edit or delete a reminder.
If the user clicks on the delete reminder button I want to show another Alert Popup that asks whether the user is sure or not.
Something like this:
AlertDialog.Builder dialog = new AlertDialog.Builder(this);
AlertDialog alert = dialog.Create();
alert.SetTitle("Edit or Delete?");
alert.SetMessage("Would you like to edit your reminder or delete it?");
alert.SetIcon(Resource.Drawable.image_2020_09_29T09_45_02_165Z);
alert.SetButton("Delete", (c, ev) =>
{
alert.SetTitle("Delete Reminder");
alert.SetMessage("Are you sure!");
alert.SetIcon(Resource.Drawable.Screenshot_2020_11_10_at_8_05_44_AM);
alert.SetButton("yes", (c, ev) =>
{
TextView _txtLabel;
reminder = listitem[e.Position];
ReminderHelper.DeleteReminder(this,reminder);
_txtLabel = FindViewById<TextView>(Resource.Id.txt_label);
StartActivity(new Intent(this, typeof(ListReminder)));
Toast.MakeText(this, "Deleted Sucessfully!", ToastLength.Short).Show();
GC.Collect();
});
alert.SetButton2("no", (c, ev) => { });
});
alert.SetButton2("Edit", (c, ev) =>
{
StartActivity(new Intent(this, typeof(MainActivity)));
});
alert.SetButton3("Cancel", (c, ev) => { });
alert.Show();
However in the code above when I press the "Delete" button the reminder is not deleted.
Any help appreciated!