I have the following code in an Activity that starts a dialog for a layout that contains a fragment.
...
case R.id.pick_resource:
dialog = new Dialo
Another answer that could help someone else: I had a similar problem but instead of destroying the fragment in the onDestroy, I had to move it to onPause in order to get it to work:
@Override
protected void onPause() {
if(adFragment != null){
childFragmentManager.beginTransaction().remove(adFragment).commitAllowingStateLoss();
}
super.onPause();
}