title: Proper Up Navigation From Fragment to Activity
body: <p>I am currently working on an app that consists of a base activity that manages several fragments.  One of those fragments is a list which when clicking on an item launches a details activity.  I would like when I click on the home button ( Using ABS ) for the app to navigate back to the listfragment but instead it always navigates back to the fragment I specified as the default.</p>
  
  <pre><code>Base Activity
      Frag1 - Default
      Frag2
      Frag3 -&gt; DetailsActivity
  </code></pre>
  
  <p>When home button is pressed from DetailsActivity I want to go back to Frag3 instead I go to Frag1.</p>
  
  <p>Any help would be great.  Here is the code I have in the details activity to handle the home button being pressed.</p>
  
  <p>Main Activity:</p>
  
  <pre><code>@Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      // set the Above View
      if (savedInstanceState != null)
          mContent = getSupportFragmentManager().getFragment(savedInstanceState,               "mContent");
      if (mContent == null)
          mContent = new HomeFragment();
  
      // set the Above View
      setContentView(R.layout.content_frame);
      getSupportFragmentManager()
              .beginTransaction()
              .replace(R.id.content_frame, mContent)
              .commit();
  
      // set the Behind View
      setBehindContentView(R.layout.menu_frame);
      getSupportFragmentManager()
              .beginTransaction()
              .replace(R.id.menu_frame, new SlidingMenuFragment())
              .commit();
  
      // customize the SlidingMenu
      getSlidingMenu().setTouchModeAbove(SlidingMenu.TOUCHMODE_FULLSCREEN);
  }
  
  @Override
  public void onSaveInstanceState(Bundle outState) {
      getSupportFragmentManager().putFragment(outState, "mContent", mContent);
      super.onSaveInstanceState(outState);
  }
  
  public void switchContent(Fragment fragment) {
      getSlidingMenu().showContent();
  
      mContent = fragment;
      getSupportFragmentManager()
              .beginTransaction()
              .addToBackStack("test")
              .replace(R.id.content_frame, fragment)
              .commit();
  }
  </code></pre>
  
  <p>Sub Activity:</p>
  
  <pre><code>@Override
  public boolean onOptionsItemSelected(com.actionbarsherlock.view.MenuItem item) {
      switch (item.getItemId()) {
          // Respond to the action bar's Up/Home button
          case android.R.id.home:
              NavUtils.navigateUpFromSameTask(this);
              return true;
      }
      return super.onOptionsItemSelected(item);
  }
  </code></pre>