title: Previous fragment visible below new fragment
body: <p>I have a TabLayout with a ViewPager. The ViewPager have four fragments F1, F2, F3 and F4. F1 contains a FrameLayout which can have 2 fragments F11 and F12. Initially I add F11 in the FrameLayout with below code.</p>
  
  <pre><code>Fragment11 fragment11 = new Fragment11();
  fragment11.setArguments(getActivity().getIntent().getExtras());
  getActivity().getSupportFragmentManager().beginTransaction()
                  .add(R.id.fragment_container, fragment11, Constants.FRAGMENT_11)
                  .commit();
  </code></pre>
  
  <p>F11 contains a ListView. When I click on any item/row in this ListView then F11 is replaced with F12. F12 is a detail fragment.</p>
  
  <pre><code>Fragment12 fragment12 = new Fragment12();
  FragmentTransaction fragmentTransaction = getActivity().getSupportFragmentManager().beginTransaction();
  fragmentTransaction.replace(R.id.fragment_container, fragment12, Constants.FRAGMENT_12)
                      .addToBackStack(null)
                      .commit();
  </code></pre>
  
  <p>For normal app flow it works fine. Now suppose currently I am in Fragment12 and I pressed home button. Now I open any heavy application (camera or any other app) to remove my app from memory. Now I started my app again.</p>
  
  <p>Now there are two Fragment11 and one Fragment12 are visible, all at the same time. When I press back Fragment12 is removed and now two Fragment11 are visible. When I click the ListView row of Fragment11 then the top Fragment11 is replaced with Fragment12, however, the bottom Fragment11 remains there.</p>
  
  <p>This is what I want:
  When the app comes to the foreground from background then Fragment12 should be visible and when I press back Fragment12 should be popped to show Fragment11.</p>
  
  <p>How can I do this?</p>