title: Stop Dialog from showing after orientation changes
body: <p>I have a custom Dialog class in which I instantiate the dialog like this</p>
  
  <pre><code>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();
  </code></pre>
  
  <p>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?</p>
  
  <p>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</p>