In my android application, I am using a custom dialog. When I try to show the dialog, it causes an error. I don\'t know what I am doing wrong, and I am really confused.
<
Try this code
protected Dialog onCreateDialog(int id) {
Dialog dialog;
switch(id) {
case 0:
dialog = new Dialog(this);
dialog.setContentView(R.layout.paused);
dialog.setTitle("Game Paused");
dialog.show();
break;
default:
dialog = null;
}
return null;
}
I just replaced dialog = new Dialog(getApplicationContext()) to dialog = new Dialog(this);