0

我怎么了AlertDialogLogcat仅到达“在构建器设置项目之后”,然后它停止并且没有错误消息。应用程序的其余部分继续没有问题。想不通为什么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");
4

2 回答 2

0

我将插件更改为扩展 CordovaPlugin 而不是 Plugin,问题就消失了。

于 2013-02-26T20:47:35.193 回答
-1

你必须写

builder.create().show();

代替

builder.show();
于 2013-02-26T20:42:24.477 回答