机器人从一个对话框显示另一个对话框 [英] Android display another dialog from a dialog

查看:160
本文介绍了机器人从一个对话框显示另一个对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想显示从另一个对话框中的一个按钮的onclick听众的对话,但第二个对话框不会显示。我搜索,发现类似problem- 对话框秩序的Andr​​oid ,试图解决方案提供,但即使这是行不通的。

I am trying to display a dialog from the onClick listener of a button of another dialog, but the 2nd dialog won't display. I searched and found a similar problem- Dialogs order in Android, tried the solution provided, but even that does not work.

我code是非常类似于在回答中提供的

My code is very similar to the one provided in the answer.

公共无效的onClick(DialogInterface   对话框,INT ID){               的ShowDialog(SECOND_DIALOG);               dialog.dismiss();           }

public void onClick(DialogInterface dialog, int id) { showDialog(SECOND_DIALOG); dialog.dismiss(); }

任何帮助将是非常美联社preciated。

any help will be really appreciated.

谢谢

阿克沙伊

推荐答案

这是我怎么做的:

    if (!appPrefs.getAcceptedUsageAggrement()) {
        tracker.trackPageView("/UsageAgreementDialog");
        acceptedUsage_alertDialog = new AlertDialog.Builder(BroadcastSMSActivity.this)
        .setTitle(R.string.accept_usage_title)
        .setMessage(R.string.accept_usage_message)
        .setNegativeButton(android.R.string.cancel, new AlertDialog.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                finish();
            }
        })
        .setPositiveButton(android.R.string.ok, new AlertDialog.OnClickListener() {
            public void onClick(DialogInterface dialog, int which) {
                if (appPrefs.getAppVer().equals("")) {
                    tracker.trackEvent("Application", "Install", getAppVerName(), 1);
                } else {
                    tracker.trackEvent("Application", "Upgrade", appPrefs.getAppVer().toString()+"->"+getAppVerName(), 1);
                }
                displayRecentChanges = true;
                appPrefs.saveAppVer(getAppVerName());
                appPrefs.saveAcceptedUsageAggrement(true);
            // Display Recent Changes on 1st use of new version
                if (displayRecentChanges) {
                    tracker.trackPageView("/RecentChangesDialog");
                    recentChanges_alertDialog = new AlertDialog.Builder(BroadcastSMSActivity.this)
                    .setTitle(getString(R.string.changes_title, getAppVerName()))
                    .setMessage(R.string.changes_dialog)
                    .setPositiveButton(android.R.string.ok, new AlertDialog.OnClickListener() {
                        public void onClick(DialogInterface dialog, int which) {
                            recentChanges_alertDialog.cancel();
                            acceptedUsage_alertDialog.cancel();
                        }
                    })
                    .create();
                    recentChanges_alertDialog.show();
                }
            }
        })
        .create();
        acceptedUsage_alertDialog.show();
    }

这篇关于机器人从一个对话框显示另一个对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆