无法在警报对话框中单击确认或取消 - Android / Java

时间:2016-12-02 14:46:00

标签: android alertdialog android-alertdialog

出于某种原因,当我显示AlertDialog时 - 显示警报,但是按下时按钮都没有响应。注意:我通过推送通知调用警报(不确定它是否有所作为。)

来源:Setup.java

import cn.pedant.SweetAlert.SweetAlertDialog;

...

public class Setup extends FragmentActivity implements OnMenuItemClickListener{

...



    public void newAlert() {
         SweetAlertDialog alert;
        alert = new SweetAlertDialog(Setup.getInstance(), SweetAlertDialog.NORMAL_TYPE);
        alert.setTitleText("Cruise Planners Mobile");
        alert.setContentText("Currently No Agents Available");
        alert.setCancelable(true);
        alert.setCancelText("Cancel");
        alert.setConfirmText("Retry");
        alert.showCancelButton(true);
        alert.setConfirmClickListener(new SweetAlertDialog.OnSweetClickListener() {
            @Override
            public void onClick(SweetAlertDialog sDialog) {
                sDialog.dismiss();
                DataManager.clientChatSendRequest(Setup.getInstance());

            }
        });
        alert.setCancelClickListener(new SweetAlertDialog.OnSweetClickListener() {
            @Override
            public void onClick(SweetAlertDialog sDialog) {
                sDialog.dismiss();
            }
        });
        alert.show();
    }

来源:GCMIntentService.java

...
public class GCMIntentService extends GCMBaseIntentService {

...


 Setup alert = new Setup();

 alert.newAlert();

...

https://github.com/pedant/sweet-alert-dialog

1 个答案:

答案 0 :(得分:0)

尝试在alert.show()之前添加此行:

.pc

并添加到您的清单中:

alertDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);