Android 无法添加窗口标记null不适用于应用程序
我想在BaseExpandableListAdapter中显示alertdialog,但它显示了一个错误: 无法添加窗口标记null不适用于应用程序 我的代码是:Android 无法添加窗口标记null不适用于应用程序,android,dialog,adapter,Android,Dialog,Adapter,我想在BaseExpandableListAdapter中显示alertdialog,但它显示了一个错误: 无法添加窗口标记null不适用于应用程序 我的代码是: LayoutInflater factory = LayoutInflater.from(this.context); final View alertDialogView = factory.inflate(R.layout.alertdialog_enter_km, null); final AlertDi
LayoutInflater factory = LayoutInflater.from(this.context);
final View alertDialogView = factory.inflate(R.layout.alertdialog_enter_km, null);
final AlertDialog.Builder builder = new AlertDialog.Builder(this.context);
builder.setTitle(R.string.common_caution);
builder.setMessage(messageId);
builder.setIcon(android.R.drawable.ic_dialog_alert);
builder.setView(alertDialogView);
我猜是这样的。上下文不起作用。有什么想法吗?谢谢我想您需要您的活动上下文来显示AlertDialog。。只是一个建议。我不知道这个.context是什么..它取代了getActivity