title: DialogFragment illegalstateException when showing from asynctasks
body: <ol>
  <li>I have an asyncTaks doing some background Operation resulting updating UI</li>
  <li>The user starts the activity, and start an AsyncTask to do some background work.</li>
  <li>The user taps home key to leave the application. onSaveInstanceState() is called.</li>
  <li>The AsyncTask finishes, and try to show a DialogFragment or LoginFragment depending on result on  onPostexecute().</li>
  <li>Since it performs the FragmentTransaction after onSaveInstance(). The IllegaeStateException occurs.</li>
  <li>To deal with loginfragments i am calling commitAllowingStateLoss(); instead of commit(); . It solve the problem for loginfragment</li>
  </ol>
  
  <p>My question is what should i do for my dialogfragment. </p>
  
  <pre><code>private void networkError(){
      NetowrkErrorDialog mErrorDialog = NetowrkErrorDialog.newInstance();
      mErrorDialog.setStyle(DialogFragment.STYLE_NO_FRAME, android.R.style.Theme_DeviceDefault_NoActionBar_Fullscreen);
      mErrorDialog.setCancelable(false);
      if(mErrorDialog.isVisible()==false){
          mErrorDialog.show(mMainActivity.getSupportFragmentManager(), "networkerror");
      }
  
  }
  </code></pre>