2013-02-26 89 views
0

我的AlertDialog有什麼問題? Logcat只能得到「建設者設置項目後」,然後停止並且沒有錯誤消息。其餘的應用程序繼續沒有問題。無法弄清楚爲什麼AlertDialog不會顯示。AlertDialog沒有顯示,也沒有錯誤信息

AlertDialog.Builder builder = new AlertDialog.Builder(this.cordova.getActivity()); 
Log.d(LOG_TAG, "after new AlertDialog"); 
builder.setTitle(title); 
Log.d(LOG_TAG, "after builder set title"); 
CharSequence[] choicesAsCharSeq = choices.toArray(new CharSequence[choices.size()]); 
builder.setItems(choicesAsCharSeq, new DialogInterface.OnClickListener() { 
    public void onClick(DialogInterface dialog, int which) { 
     // The 'which' argument contains the index position 
     // of the selected item 
     Log.d(LOG_TAG, "Index #" + which + " chosen."); 
     String result = ""; 
     result = "" + which; 
     // ActionSheet.this.callbackContext.sendPluginResult(new PluginResult(PluginResult.Status.OK, result)); 
    } 
}); 
Log.d(LOG_TAG, "after builder set items"); 
builder.show(); 
Log.d(LOG_TAG, "after builder show"); 
+0

你在你的標籤中提到logcat。那麼,logcat在哪裏? – DigCamara 2013-02-26 19:44:19

+0

可能你會從appwidget或非UI線程調用對話框。 – 2013-02-26 19:49:25

+0

我想這個問題不需要logcat本身。 – celwell 2013-02-26 19:52:37

回答

0

我只好寫的

builder.create().show(); 

代替

builder.show(); 
+0

好吧,它甚至不會運行create()(我之前嘗試過) – celwell 2013-02-26 20:43:47

+0

如果尚未完成,顯示將自動創建對話框。 – AedonEtLIRA 2013-02-26 20:44:31

0

我改變了我的插件來擴展CordovaPlugin而非插件和問題走了。