title: Pop fragment from backstack and add it again
body: <p>I have two fragments <strong>friendListFragment</strong> and <strong>logListFragment</strong>.</p>
  
  <pre><code>    FragmentManager fm = getSupportFragmentManager();
      FragmentTransaction ft = fm.beginTransaction();
  
      FriendListFragment friendListFragment = (FriendListFragment)fm.findFragmentById(R.id.friend_list_fragment_container);
      LogListFragment logListFragment = (LogListFragment)fm.findFragmentById(R.id.log_list_fragment_container);
  </code></pre>
  
  <p>The latter is created in the context of the <strong>onListItemClick</strong> event of the former. </p>
  
  <pre><code>    fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
      logListFragment = LogListFragment.newInstance(name);
      ft.add(R.id.log_list_fragment_container, logListFragment);
      if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
          ft.hide(friendListFragment);
      }
      ft.addToBackStack(null);
      ft.commit();
  </code></pre>
  
  <p>With every call of <strong>onListItemClick</strong> I clear the backstack first, because I only want to have the latest <strong>logListFragment</strong> on the backstack.</p>
  
  <p>In the <strong>onCreate</strong> function of my activity I take care about the orientation of my phone. In portrait mode I clear the backstack and add the <strong>logListFragment</strong> again in the following way:</p>
  
  <pre><code>    if ((logListFragment != null) &amp;&amp; (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT)) {
          fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
          ft.add(R.id.log_list_fragment_container, logListFragment);
          ft.hide(friendListFragment);
          ft.addToBackStack(null);
          ft.commit();
      }
  </code></pre>
  
  <p>After that the <strong>friendListFragment</strong> is hidden as expected, but also the <strong>logListFragment</strong> isn't visible.
  When I change the code the following way it works as expected:</p>
  
  <pre><code>    if ((logListFragment != null) &amp;&amp; (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT)) {
          LogListFragment copy = new LogListFragment();
          copy.setArguments(logListFragment.getArguments());
          fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
          ft.add(R.id.log_list_fragment_container, copy); // &lt;- use copy
          ft.hide(friendListFragment);
          ft.addToBackStack(null);
          ft.commit();
      }
  </code></pre>
  
  <p>When I add a new instance of <strong>LogListFragment</strong> it works.</p>
  
  <p><strong>Questions</strong>:</p>
  
  <ol>
  <li>Why do I need to create a new instance?</li>
  <li>Does someone know a better solution?</li>
  </ol>