Here is the answer in another thread:
Actions in onActivityResult and “Error Can not perform this action after onSaveInstanceState”
also here:
Refreshing my fragment not working like I thought it should
This is an example solving this problem:
DialogFragment loadingDialog = createDialog();
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.add(loadingDialog, "loading");
transaction.commitAllowingStateLoss();