@Override
    public void onBackPressed() {
        super.onBackPressed();
        new SweetAlertDialog(context,SweetAlertDialog.NORMAL_TYPE)
                .setTitleText("Cancel Create Account?")
                .setContentText("Do yo u really want to cancel sign up? press yes to exit.")
                .setConfirmText("Yes")
                .setCancelText("No")
                .setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {
                    @Override
                    public void onClick(SweetAlertDialog sweetAlertDialog) {
                        sweetAlertDialog.dismissWithAnimation();
                        RegisterMerDetailsActivity.this.finish();
                    }
                })
                .show();
    }


show方法指出了泄漏的窗口错误。我仍在尝试为什么会这样。但仍然出现相同的错误。

最佳答案

添加以下代码

@override
public void onDestroy()
{
    super.onDestroy();
    sweetAlertDialog.dismissWithAnimation();
}

10-06 13:32