Reputation: 47807
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
Upvotes: 7
Views: 16247
Reputation: 18933
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);
Upvotes: 1
Reputation: 24853
Try to import
import android.app.AlertDialog;
and also if your using this line AlertDialogManager alert = new AlertDialogManager();
remove it and try.
Upvotes: 6
Reputation: 12042
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);
Upvotes: 3