title: Return from fragment C to fragment A pressing back button
body: <p>I have a fragments, for example A -> B -> C. When I'm in the fragment C, and press the back button I need to get on a fragment A. That is, fragment B is not necessary to add to backStack. Here is the code which implements the transition between fragments.</p>
  
  <pre><code>FragmentManager fragmentManager = this.getSupportFragmentManager();
  FragmentTransaction transaction = fragmentManager.beginTransaction();
  transaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN);
  
  Fragment fragment = fragmentManager.findFragmentByTag(tag);
  fragment.getArguments().putAll(args);
  
  transaction.replace(idContainer, fragment, tag);
  transaction.addToBackStack(null);
  transaction.commit();
  </code></pre>
  
  <p>At the opening of the fragment C, I don't use <em>transaction.addToBackStack(null);</em></p>
  
  <p>And now I have the following problem. From the fragment С I click the back button and enters the fragment A, but two layers of fragments are superimposed on each other.</p>
  
  <p><a href="https://i.stack.imgur.com/aMvrz.png" rel="nofollow noreferrer">Like this screenshot</a></p>