简体   繁体   English

android对话框泄漏窗口在android 4.0中但不是在2.3中

[英]android dialog leaking window in android 4.0 but not in 2.3

i have an alert dialog with a continue button. 我有一个带有继续按钮的警报对话框。 when click the button the dialog should dismiss and lunch a new Intent. 当单击按钮时,对话框应关闭并使用新的Intent。 from some reason in Android 2.3 it works good but in Android 4.0 i get window leak... this is my code: 由于某些原因,在Android 2.3中运行良好,但是在Android 4.0中,我出现窗口泄漏...这是我的代码:

        continueButton.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                if (cls != null)
                {
                    dismiss();
                    Intent i = new Intent(activity,cls);
                    activity.startActivity(i);
                }
             }
        });

any ideas ? 有任何想法吗 ?

Do you mean a button inside the AlertDialog's view? 您是指AlertDialog视图中的按钮吗? If not, you can use AlertDialogue.Builder.setPositivebutton / negative / neutral to move out of the dialogue. 如果没有,则可以使用AlertDialogue.Builder.setPositivebutton /否定/中立退出对话框。 Clicking these buttons automatically dismiss the dialogue. 单击这些按钮将自动关闭对话框。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM