I have a custom Dialog class in which I instantiate the dialog like this
dg = new Dialog(con);
dg.requestWindowFeature(Window.FEATURE_NO_TITLE);
Window window = dg.getWindow();
window.setBackgroundDrawableResource(android.R.color.transparent);
dg.setContentView(R.layout.listview_dialog_layout);
//set views etc..
dg.show();
When an orientation change occurs in the activity that the dialog is shown the activity data changes are lost but the dialog still stays open. I would like the dialog to be dismissed at orientation changes just like it happens with the default Dialog created through an AlertDialog.Builder. How can I do that?
I prefer a solution that is implemented in the custom Dialog class instead of going to every activity and type dialog.dismiss(); at activity pause or stop