Yes, I know there's AlertDialog.Builder, but I'm shocked to know how difficult (well, at least not programmer-friendly) to display a dialog in Android.
I used to be a .NET developer, and I'm wondering is there any Android-equivalent of the following?
if (MessageBox.Show("Sure?", "", MessageBoxButtons.YesNo) == DialogResult.Yes){
// Do something...
}
Show dialog anonymously as chain of commands & without defining another object:
Try this:
Steves answer is correct though outdated with fragments. Here is an example with FragmentDialog.
The class:
To start dialog:
You could also let the class implement
onClickListener
and use that instead of embedded listeners.