问题
is there something like dialog's order in Android?
I explain what I mean.
There is a dialog builder with "OK"-Button. When user press ok, dialog will be closed.
Wenn I call more than one dialogs after each other in an activity, I see first the last one, then next to last and so on. But I would like to see first the first dialog, then the second, then ...
Is there the possibility for that?
Or is it possible not to call second dialog until first dialog isn't closed?
Mur
回答1:
When you define the onClick() method for your dialog's "Ok" button (setNeutralButton()), you'll have to display the second dialog (via showDialog() or similar) and then dismiss the first dialog.
An example:
builder = new Builder(context);
builder
.setTitle(R.string.dialog_download_failed_title)
.setMessage(R.string.dialog_download_failed_message)
.setCancelable(true)
.setNeutralButton(android.R.string.ok, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
showDialog(SECOND_DIALOG);
dialog.dismiss();
}
});
来源:https://stackoverflow.com/questions/3989767/dialogs-order-in-android