Hmm.. I am getting an errors saying the constructor is undefined.
Dele.setOnClickListener(new OnClickListener() {
public void onClick(View arg0) {
EditText DelSel = (EditText) findViewById(R.id.ETDeleteSelect);
int Id = Integer.parseInt(DelSel.getText().toString());
builder = new ***AlertDialog.Builder(this);***
builder.setMessage("Are you sure you want to exit?")
.setCancelable(false)
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
MyActivity.this.finish();
}
})
.setNegativeButton("No", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
can someone tell me whats the fix? i get an error called
“The constructor AlertDialog.Builder(new View.OnClickListener(){}) is undefined”
What i am trying to do is open a message box when a button is clicked where to continue or not. so someone please help me out.
Replace
thiswith :The
AlertDialog.Builderconstructor expects aContextreference and right now you giving it aOnClickeListenerreference(because you’re usingthisin the anonymousOnClickListenerclass that you declare as your listener).