title: actionbar up navigation with fragments
body: <p>I have a tabbed Actionbar/viewpager layout with three tabs say <strong>A</strong>, <strong>B</strong>, and <strong>C</strong>. In tab <strong>C</strong> tab(fragment),I am adding another fragment say fragment <strong>D</strong>. with</p>
  
  <pre><code> DFragment f= new DFragment();
   ft.add(android.R.id.content, f, "");
   ft.remove(CFragment.this);
   ft.addToBackStack(null);
   ft.commit();
  </code></pre>
  
  <p>I modify actionbar in DFragment's onResume to add up button:</p>
  
  <pre><code>ActionBar ab = getActivity().getActionBar();
  ab.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
  ab.setDisplayHomeAsUpEnabled(true);
  ab.setDisplayShowHomeEnabled(true);
  </code></pre>
  
  <p>Now in DFragment, when I press hardware(phone) Back button, I return to the original Tabbed(ABC) layout with CFragment selected. How can I achieve this functionality with actionbar up button?</p>