I need to dismiss DialogFragment in onStop() of an FragmentActivity if it is showing, this is what I did
if(mAlertDlg != null && mAlertDlg.getDialog() != null)
You should use
dialogFragment.dismissAllowingStateLoss(). As the documentation say for
"Like commit() but allows the commit to be executed after an activity's state is saved. This is dangerous because the commit can be lost if the activity needs to later be restored from its state, so this should only be used for cases where it is okay for the UI state to change unexpectedly on the user."
dismissAllowingStateLoss() is the same approach.