AlertDialog.Builder cannot be resolved to a type error

M D picture M D · Dec 19, 2013 · Viewed 14.7k times · Source

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

Answer

Timothy T. picture Timothy T. · Dec 19, 2013

You have to import this

import android.app.AlertDialog.Builder