So lets say I have the following Fragments:
Fragment1 Fragment2 DialogFragment Fragment3 Fragment4
Lets say I go to the following Fragments, each fragmetn is added to the back stack:
Fragment1 -> Fragment2 -> DialogFragment -> Fragment3 -> Fragment4
If I click the BACK button this should normally go to Fragment3 but instead DialogFragment is displayed.
Here are the Fragment Transactions I used:
Fragment1 -> Fragment2
FragmentTransaction ft = mActivity.getSupportFragmentManager().beginTransaction();
ft.replace(R.id.mainContentHolder, new Fragment2(), "Fragment2");
ft.addToBackStack(null);
ft.commit();
Fragment2 -> DialogFragment
FragmentTransaction ft2 = getFragmentManager().beginTransaction();
ft2.setCustomAnimations(R.anim.flipp_in,R.anim.flipp_static);
ft2.add(R.id.mainContentHolder, new DialogFragment(), "DialogFragment");
ft2.addToBackStack(null);
ft2.commit();
ft2.hide(Fragment1.this);
DialogFragment -> Fragment3
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.mainContentHolder, new Fragment3(), "Fragment3");
ft.addToBackStack(null);
ft.commit();
Fragment3 -> Fragment4
FragmentTransaction ft = getFragmentManager().beginTransaction();
ft.replace(R.id.mainContentHolder, new Fragment4(), "Fragment4");
ft.addToBackStack(null);
ft.commit();
Again the problem is that when I'm in Fragment4 and click the BACK button the DialogFragment is displayed instead of Fragment3.