当前位置: 动力学知识库 > 问答 > 编程问答 >

android - AlertDialog.Builder cannot be resolved to a type error

问题描述:

I receive the error on the line below:

AlertDialog.Builder alrtDialog = new AlertDialog.Builder(this);

The Error show is :

AlertDialog.Builder cannot be resolved to a type

I import the following for this:

import android.content.DialogInterface;

the java code in the example(from android programming unleashed) includes

android.app.AlertDialog but importing this results in message: conflicts with a type defined in the same file

网友答案:

You have to import this

import android.app.AlertDialog.Builder

网友答案:

first check that you have import the corresponding package

import android.app.AlertDialog; and then c

check that you are using your activity instance

AlertDialog.Builder alert = new AlertDialog.Builder(yourActivityname.this);
网友答案:

Try to import

import android.app.AlertDialog;

and also if your using this line AlertDialogManager alert = new AlertDialogManager(); remove it and try.

网友答案:

You must import your AlertDialog

import android.app.AlertDialog.Builder

instead of

import android.content.DialogInterface;

Also Change

AlertDialog.Builder  alrtDialog = new AlertDialog.Builder(YourActivity.this);
分享给朋友:
您可能感兴趣的文章:
随机阅读: