更改“警报”对话框上的消息或更好的解决方案

时间:2016-11-07 07:21:44

标签: android

我在屏幕上显示了DIALOG_start_NFC提醒对话框,我希望在方法MethodName中关闭它并显示对话框DIALOG_Process_CertificateGeneration,并在每个提醒对话框DIALOG_Process_CertificateGeneration上更改消息一步。
但是方法MethodNam Desplaymsg()已执行,但DIALOG_start_NFC不会被解雇。我无法得到对话DIALOG_Process_CertificateGeneration

protected Dialog onCreateDialog(int id, Bundle args) {
    switch (id) {

        case DIALOG_start_NFC :
            // A dialog that we show when we are ready to write to a tag:
            return new AlertDialog.Builder(this)
                    .setTitle("title")
                    .setMessage("msg ")
                    .setCancelable(true)
                    .setNeutralButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
                        public void onClick(DialogInterface d, int arg) {
                            d.cancel();
                        }
                    })
                    .setOnCancelListener(new DialogInterface.OnCancelListener() {
                        public void onCancel(DialogInterface d) {
                            bstartnfc = false;
                        }
                    }).create();
        case DIALOG_Process_CertificateGeneration:

            return new AlertDialog.Builder(this)
                    .setTitle("title")
                    .setMessage(args.getString("msg"))
                    .setCancelable(false)
                    .setPositiveButton("confirm ",new
                            DialogInterface.OnClickListener() {
                                public void onClick(DialogInterface dialog, int which) {
                                    finish();
                                }
                            }).create();



    }
}

我将它用于此方法:

private void MethodName()
{
    Desplaymag("method2");
    method2();

    Desplaymag( "method3");
    method3();
}

private void DisplayMsg(String msg)
{
    Bundle arg= new Bundle();
    arg.putString("msg"," step: " + msg);
    CertificateGenerationActivity.this.showDialog(DIALOG_Process_CertificateGeneration,arg);
}

我希望在执行method2之前和Methode2之前收到消息Method3。但是在执行method2method3后的代码中,我的消息已更改

0 个答案:

没有答案