I'm implementing a custom dialog, but in the activity, I'm having a trouble. This is the code:
public class MainActivity extends Activity { private Button button; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); button = (Button) findViewById(R.id.buttonDialog); /*Add button listener*/ button.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { /*Custom dialog*/ final Dialog dialog = new Dialog(this); dialog.setTitle("Cerrar App"); dialog.setContentView(R.layout.custom_dialog); //... In the line final Dialog dialog = new Dialog(this); it's throwing me an error that says: The constructor Dialog(new View.OnClickListener(){}) is undefined.
What I'm doing wrong?