2016-03-15 49 views
-1
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 

我該如何解決呢?

+0

檢查'context' –

回答

0

嘗試......

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

它可以幫助你!