I am trying to make an alert dialog, but after I entered all the code, Eclipse gave me an error on a line that reads
More specifically new AlertDialog.Builder(this)
The error says, "The constructor AlertDialog.Builder(new View.OnClickListener(){}) is undefined.
I can't find any solutions on developer.android.com, but I might just be bad at looking. I used the Google example and the same thing happened.
Here is the the rest of the code.
Code:
AlertDialog.Builder builder = [COLOR="Red"]new AlertDialog.Builder(this)[/COLOR];
The error says, "The constructor AlertDialog.Builder(new View.OnClickListener(){}) is undefined.
I can't find any solutions on developer.android.com, but I might just be bad at looking. I used the Google example and the same thing happened.
Here is the the rest of the code.
Code:
Button aboutButton = (Button) findViewById(R.id.Button06);
aboutButton.setOnClickListener(new View.OnClickListener(){
public void onClick(View v) {
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage("The Crossing Version 0.1")
.setCancelable(true)
.setNeutralButton("Close", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
crossingActivity.this.finish();
}
});
AlertDialog alert = builder.create();
}