Android Custom Dialog
Consider the pattern:
private static final int MY_DIALOG= 0;
protected Dialog onCreateDialog(int id) {
Dialog dialog;
switch(id) {
case MY_DIALOG:
dialog= getInstanceMyDialog();
break;
default:
dialog = null;
}
return dialog;
}
private Dialog getInstanceMyDialog() {
final Dialog d= new Dialog(this); //<=====THIS
d.setContentView(R.layout.custom_dialog);
d.setTitle("Custom Dialog");
return d;
}
JAL
This worked for me: problem-creating-a-custom-dialog
Use this instead of getApplicationContext() when instantiating the dialog:
Dialog dialog = new Dialog(this);