title: Android Fragments - dealing with the backbutton
body: <p>I am launching some fragments from my options menu, for example a preference fragment and a dialog fragment.  </p>
  
  <p>When I open the preferences fragment and hit the back button the entire activity closes.  This is not the case for the dialog fragment that works as I'd expect. </p>
  
  <p>Could someone explain why this is happening and what is the accepted way of handling please? :)</p>
  
  <p>To launch preference fragment:</p>
  
  <pre><code>getFragmentManager().beginTransaction()
                  .add(android.R.id.content, new SettingsFragment())
                  .addToBackStack("settings")
                  .commit();
  </code></pre>