title: Fragment transactions, actionbar & backstack
body: <p>In  my main activity, I have an actionbar with <code>NAVIGATION_MODE_TABS</code>. The contents of each tab is a listfragment.</p>
  
  <p>I'd like to make it so that that when a listitem is clicked, a new fragment is brought into view, and the actionbar mode is changed to <code>NAVIGATION_MODE_STANDARD</code> (so that the tabs are now hidden).</p>
  
  <p>I've managed to get this to work with the following code:</p>
  
  <p>In the listitemclick method:</p>
  
  <pre><code>        ActionBar actionBar = getActivity().getActionBar();
          actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
  
          Fragment albumListFragment = new AlbumListFragment();
          albumListFragment.setArguments(bundle);
          FragmentTransaction ft = getFragmentManager().beginTransaction();
  
          ft.replace(android.R.id.content, albumListFragment);
          ft.addToBackStack(null);
  
          // Commit the transaction
          ft.commit();
  
          Log.i("FragmentList", "Item clicked: " + id);
  </code></pre>
  
  <p>The problem is when I press the back button, the tabs are still gone, and the previous fragment doesn't come back into view.</p>
  
  <p>Am I doing something wrong.. Is it something to do with the fragment backstack? Should I go about it another way, or even override the backpress?</p>
  
  <p>--Edit--</p>
  
  <p>For clarity - I am calling addToBackStack when I call fragmenttransaction.replace, but when I press the back button, the previous fragment is not restored.</p>