In Android Dialogs are asynchronous so you're going to have to structure your code a little differently.
So in C# your logic ran something like this in pseudocode:
void doSomeStuff() {
int result = showDialog("Pick Yes or No");
if (result == YES) {
//do stuff for yes
}
else if (result == NO) {
//do stuff for no
}
//finish off here
}
For Android it's going to have to be less neat. Think of it like so. You'll have an OnClickListener
like this:
public void onClick(DialogInterface dialog, int whichButton) {
if (whichButton == BUTTON_POSITIVE) {
doOptionYes();
}
else if (whichButton == BUTTON_NEGATIVE) {
doOptionNo();
}
}
Which is then supported by the following methods:
void doOptionYes() {
//do stuff for yes
endThings();
}
void doOptionNo() {
//do stuff for no
endThings();
}
void endThings() {
//clean up here
}
So what was one method is now four. It may not seem as neat but that's how it works I'm afraid.