开发者

Dialogs order in Android

开发者 https://www.devze.com 2023-01-20 15:34 出处:网络
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.

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开发者_JS百科 possible not to call second dialog until first dialog isn't closed?

Mur


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();
        }
    });
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号