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

Android 更改警报对话框上的消息或更好的解决方案,android,Android,我在屏幕上显示了一个DIALOG\u start\u NFCalert对话框,我想在methodMethodName中关闭它,并显示DIALOGDIALOG\u Process\u CertificateGeneration和每个步骤的alert DIALOGDIALOG\u Process\u CertificateGeneration上的更改消息。 但是在方法MethodNam desplaymg()中执行,但是对话框\u start\u NFC不会关闭。我无法获得dialogdialog\

我在屏幕上显示了一个
DIALOG\u start\u NFC
alert对话框,我想在method
MethodName
中关闭它,并显示DIALOG
DIALOG\u Process\u CertificateGeneration
和每个步骤的alert DIALOG
DIALOG\u Process\u CertificateGeneration
上的更改消息。
但是在方法
MethodNam desplaymg()
中执行,但是
对话框\u start\u NFC
不会关闭。我无法获得dialog
dialog\u Process\u 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
之前获取消息
method2
,也要获取
Method3
的消息。但是在执行
method2
method3
之后,我的消息被更改了