title: PopBackStack is not working properly
body: <p>I have coded like this:</p>
  
  <p>FragA >> FragB >> FragC >> FragD</p>
  
  <p>When I press onBackpress() of FragD it goes to directly on FragA but i want to keep it go FragC.</p>
  
  <p>BackPress Code here :</p>
  
  <pre><code> if (getActivity().getSupportFragmentManager().getBackStackEntryCount() &gt; 0) {
              back_btn.setVisibility(View.GONE);
              getActivity().getSupportFragmentManager().popBackStack();
          }
  </code></pre>
  
  <p>Replacing Fragment Code : </p>
  
  <pre><code>                       FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
                         FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
                         FragmentA fragmentA = new FragmentA();
                         fragmentTransaction.replace(R.id.framelayoutinner, fragmentA);
                         fragmentTransaction.addToBackStack("fragmentA");
                         fragmentTransaction.commit();
  
  
  
                         FragmentManager fragmentManager = getActivity().getSupportFragmentManager();
                         FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
                         FragmentA fragmentB = new Fragmentb();
                         fragmentTransaction.replace(R.id.framelayoutinner_2, fragmentB);
                         fragmentTransaction.addToBackStack("fragmentB");
                         fragmentTransaction.commit();
  </code></pre>