title: android: return to specific Fragment (and pop off everything after it)
body: <p>Let's say in my app there are a few possible navigation flows (all are <code>Fragments</code>)</p>
  
  <pre><code>A -&gt; B -&gt; C -&gt; D -&gt; E
  A -&gt; F -&gt; B -&gt; C
  </code></pre>
  
  <p>I'd like to be able to return to fragment <code>B</code> regardless of the transaction backstack depth (ie. I don't want to keep track if I'm currently showing <code>E</code> or <code>C</code>). I noticed it's possible to tag the fragments, but the following  code doesn't seem to work:</p>
  
  <p>In <code>fragment A</code> create fragment <code>B</code> aka <code>SocialViewFragment</code>:</p>
  
  <pre><code>FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
  
  // Method 1 
  transaction.add(R.id.fragment_container, frag, SocialViewFragment.FRAG_TAG).commit();
  
  // Method 2
  //transaction.replace(R.id.fragment_container, frag);
  //transaction.addToBackStack(SocialViewFragment.FRAG_TAG).commit();
  </code></pre>
  
  <p>Then in <code>Fragment E</code>, <code>popBackStack</code> returns false (and does nothing), cause it can't find the tag?!</p>
  
  <pre><code>FragmentManager mgr = PlaybackFrag.this.getActivity().getSupportFragmentManager();
  if (mgr.getBackStackEntryCount() &gt; 0) {
      // Want to go back to SocialViewFragment !!!    
      mgr.popBackStack(SocialViewFragment.FRAG_TAG, 0); // returns False - can't find the tag!                
  }
  </code></pre>