title: Show DialogFragment when user clicks deny on Runtime permissions dialog
body: <p>I'm trying to show a DialogFragment right after the user clicks "Deny" on the "allow/deny permission" dialog of android 6 But instead I'm getting this error:</p>
  
  <pre><code>    Caused by: java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
    at android.support.v4.app.FragmentManagerImpl.checkStateLoss(FragmentManager.java:1448)
    at android.support.v4.app.FragmentManagerImpl.enqueueAction(FragmentManager.java:1466)
    at android.support.v4.app.BackStackRecord.commitInternal(BackStackRecord.java:634)
    at android.support.v4.app.BackStackRecord.commit(BackStackRecord.java:613)
    at android.support.v4.app.DialogFragment.show(DialogFragment.java:139)
    at android.support.v4.app.FragmentActivity.onRequestPermissionsResult(FragmentActivity.java:802)
    at android.app.Activity.dispatchRequestPermissionsResult(Activity.java:6553)
    at android.app.Activity.dispatchActivityResult(Activity.java:6432)
    at android.app.ActivityThread.deliverResults(ActivityThread.java:3695)
    at android.app.ActivityThread.handleSendResult(ActivityThread.java:3742) 
    at android.app.ActivityThread.-wrap16(ActivityThread.java) 
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1393) 
    at android.os.Handler.dispatchMessage(Handler.java:102) 
    at android.os.Looper.loop(Looper.java:148) 
    at android.app.ActivityThread.main(ActivityThread.java:5417) 
    at java.lang.reflect.Method.invoke(Native Method) 
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
  </code></pre>
  
  <p>My dialog code is pretty standard</p>
  
  <pre><code>  protected void showDialog(DialogFragment diag)
      {
          if (diag != null &amp;&amp; !diag.isAdded())
              diag.show(getSupportFragmentManager(), "dialog");
      }
  </code></pre>
  
  <p>How can this be fixed?</p>