title: Android - How to end a Fragment
body: <p>In my application I have a navigation drawer, and the way my app works is there is only one activity and if you select something from the Navigation drawer it starts/replaces the current fragment. How Can I make it so that when something is selected from the navigation drawer and a new fragment starts the old fragment ends</p>
  
  <p>I cant do</p>
  
  <pre><code>@Override
  public void onPause() {
      // TODO Auto-generated method stub
      super.onPause();
      getActivity().finish();
  }   
  </code></pre>
  
  <p>because that would kill the app since there is only one activity. </p>
  
  <p>How do I kill the fragment?</p>
  
  <p>EDIT: my fragment transaction</p>
  
  <pre><code>Home HomeFragment = new Home();
          transaction.replace(R.id.llhome, HomeFragment);
          transaction.addToBackStack(null);
          transaction.commit();
                mDrawerList.setItemChecked(position, true);
                  mDrawerLayout.closeDrawer(mDrawerList);
  </code></pre>
  
  <p>thanks</p>