title: addToBackStack Not working
body: <p>I am trying to close the fragment and wants to resume the main activity by using the addToBackStack in my fragment implimentation but it is not working. Back button is closing the application.</p>
  
  <p>The fragment implimentation method that I am using is,</p>
  
  <pre><code>  private void dispaySelectedScreen(int id) {
      Fragment fragment = null;
  
      switch (id) {
          case R.id.facebook_login:
              fragment = new FacebookLogin();
              break;
          case R.id.memes:
              fragment = new Memes();
              break;
          case R.id.submit_image:
              fragment = new SubmitImage();
              break;
          case R.id.discussion:
              fragment = new Discussions();
              break;
          case R.id.invite:
              fragment = new Invite();
              break;
          case R.id.connect_fb:
              fragment = new FacebookConnect();
              break;
          case R.id.connect_twitter:
              fragment = new TwitterConnect();
              break;
          case R.id.connect_instagram:
              fragment = new InstaConnect();
              break;
      }
  
      if (fragment != null) {
          FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
          ft.replace(R.id.content_main, fragment);
          ft.addToBackStack(null);
          ft.commit();
  
  
  
  
      }
  
      DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
      drawer.closeDrawer(GravityCompat.START);
  </code></pre>
  
  <p>I have also declared one onBackPressed method for the drawer,</p>
  
  <pre><code>@Override
  public void onBackPressed() {
      DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
      if (drawer.isDrawerOpen(GravityCompat.START)) {
          drawer.closeDrawer(GravityCompat.START);
      } else {
          super.onBackPressed();
      }
  
  
      }
  </code></pre>
  
  <p>Please suggest..</p>