title: How to prevent dialogs from showing when screen rotates
body: <p>Hey guys I am building an app that loads data from mysql through json. While data loads, a progress dialog is showing. When the loading is complete the dialog dismisses. But when I change screen rotation it shows up again and it loads the data again. How can I prevent this from happening??. And also the same happens to all alert dialogs that I use. Any help please?</p>
  
  <p>My code:</p>
  
  <pre><code>@Override
      public void onConfigurationChanged(Configuration newConfig) {
          // TODO Auto-generated method stub
  
          if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE) {
              if(!pDialog.isShowing()){
                  pDialog.show();
              }else{
                  pDialog.dismiss();
              }
              if(!onAboutPressed().isShowing()){
                  onAboutPressed().show();
              }else{
                  onAboutPressed().dismiss();
              }
              if(!onAlertMobileData().isShowing()){
                  onAlertMobileData().show();
              }else{
                  onAlertMobileData().dismiss();
              }
              super.onConfigurationChanged(newConfig);
          }
          if(newConfig.orientation == Configuration.ORIENTATION_PORTRAIT){
              if(!pDialog.isShowing()){
                  pDialog.show();
              }else{
                  pDialog.dismiss();
              }
              if(!onAboutPressed().isShowing()){
                  onAboutPressed().show();
              }else{
                  onAboutPressed().dismiss();
              }
              if(!onAlertMobileData().isShowing()){
                  onAlertMobileData().show();
              }else{
                  onAlertMobileData().dismiss();
              }
              super.onConfigurationChanged(newConfig);
          }
      }
  </code></pre>
  
  <p>I finally fixed it. it just needed as well in the manifest.</p>
  
  <pre><code>android:configChanges="orientation|keyboardHidden|screenSize"
  </code></pre>
  
  <p>Any help will be welcomed and much appreciated.</p>