如何从导航抽屉打开对话框?

时间:2016-03-15 09:56:44

标签: android dialog

  final Dialog dialog = new Dialog(context);
        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
        dialog.setContentView(R.layout.dialog_create_group);
        dialog.show();

从活动中打开对话框时运行正常。但是当我尝试从导航抽屉打开对话框时,我收到了这个例外:

Unable to add window -- token null is not for an application

我该如何解决?

1 个答案:

答案 0 :(得分:0)

试试这个......

 dialog = new ProgressDialog(Your_Class_Activity.this);
             dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
            dialog.setContentView(R.layout.dialog_create_group);
            dialog.show();

可以帮到你!