AlertDialog.Builder无法解析为类型错误

M D*_*M D 6 android android-dialog

我在下面的行中收到错误:

AlertDialog.Builder  alrtDialog = new AlertDialog.Builder(this);
Run Code Online (Sandbox Code Playgroud)

错误显示是:

AlertDialog.Builder无法解析为某种类型

我为此导入以下内容:

import android.content.DialogInterface;
Run Code Online (Sandbox Code Playgroud)

示例中的java代码(来自android编程释放)包括android.app.AlertDialog但导入此结果的消息:与同一文件中定义的类型冲突

Tim*_* T. 13

你必须导入它

import android.app.AlertDialog.Builder


Har*_*ran 5

尝试 import

import android.app.AlertDialog;
Run Code Online (Sandbox Code Playgroud)

并且如果您使用此行,AlertDialogManager alert = new AlertDialogManager();请将其删除并尝试。