title: action bar button not opening drawer
body: <p>I have a fragment activity with an actionbar that should open the navbar when you click the home screen icon with the three line icon that represents the drawer opening for android. </p>
  
  <p>For some reason, I can click the button but its not opening the drawer... I can open the drawer by using the sliding gesture...</p>
  
  <pre><code>public class MainDrawer2 extends FragmentActivity
  {
      private static final String EXTRA_NAV_ITEM    = "extraNavItem";
      private static final String STATE_CURRENT_NAV = "stateCurrentNav";
  
      private ActionBarDrawerToggle mDrawerToggle;
      private DrawerLayout mDrawerLayout;
  
      private NavDrawerListAdapter mDrawerAdapter;
      private ListView mDrawerList;
  
      private CharSequence mTitle;
      private CharSequence mDrawerTitle;
  
      private MainNavItem mCurrentNavItem;
  
  
      public static Intent createLaunchFragmentIntent(Context context, MainNavItem navItem)
      {
          return new Intent(context, MainDrawer2.class)
                  .putExtra(EXTRA_NAV_ITEM, navItem.ordinal());
      }
  
      @Override
      protected void onCreate(Bundle savedInstanceState)
      {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.fragment_main);
  
          mTitle = mDrawerTitle = getTitle();
          mDrawerLayout = (DrawerLayout)findViewById(R.id.drawer_layout);
          mDrawerList   = (ListView)findViewById(R.id.drawer);
  
          getActionBar().setDisplayHomeAsUpEnabled(true);
          enableHomeButtonIfRequired();
  
          mDrawerAdapter = new NavDrawerListAdapter(getApplicationContext());
          mDrawerList.setAdapter(mDrawerAdapter);
          mDrawerList.setOnItemClickListener(new ListView.OnItemClickListener()
          {
              @Override
              public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id)
              {
                  displayNavFragment((MainNavItem)parent.getItemAtPosition(position));
              }
          });
  
          mDrawerToggle = new ActionBarDrawerToggle(this, mDrawerLayout,
                  R.drawable.ic_drawer, R.string.app_name, R.string.app_name)
          {
              public void onDrawerClosed(View view)
              {
                  getActionBar().setTitle(mTitle);
                  invalidateOptionsMenu();
              }
  
              public void onDrawerOpened(View drawerView)
              {
                  getActionBar().setTitle(mDrawerTitle);
                  invalidateOptionsMenu();
              }
          };
  
          mDrawerLayout.setDrawerListener(mDrawerToggle);
  
          if(getIntent().hasExtra(EXTRA_NAV_ITEM)){
              MainNavItem navItem = MainNavItem.values()
                      [getIntent().getIntExtra(EXTRA_NAV_ITEM,
                      MainNavItem.STATISTICS.ordinal())];
              displayNavFragment(navItem);
          }
          else if(savedInstanceState != null){
              mCurrentNavItem = MainNavItem.values()
                      [savedInstanceState.getInt(STATE_CURRENT_NAV)];
              setCurrentNavItem(mCurrentNavItem);
          }
          else{
              displayNavFragment(MainNavItem.STATISTICS);
          }
      }
  
      @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
      private void enableHomeButtonIfRequired()
      {
          if(Build.VERSION.SDK_INT &gt;= Build.VERSION_CODES.ICE_CREAM_SANDWICH){
              getActionBar().setHomeButtonEnabled(true);
          }
      }
  
      @Override
      public void setTitle(CharSequence title)
      {
          mTitle = title;
          getActionBar().setTitle(mTitle);
      }
  
      @Override
      protected void onPostCreate(Bundle savedInstanceState)
      {
          super.onPostCreate(savedInstanceState);
          // Sync the toggle state after onRestoreInstanceState has occurred.
          mDrawerToggle.syncState();
      }
  
      @Override
      public void onConfigurationChanged(Configuration newConfig)
      {
          super.onConfigurationChanged(newConfig);
          // Pass any configuration change to the drawer toggles
          mDrawerToggle.onConfigurationChanged(newConfig);
      }
  
      @Override
      protected void onSaveInstanceState(Bundle outState)
      {
          super.onSaveInstanceState(outState);
          outState.putInt(STATE_CURRENT_NAV, mCurrentNavItem.ordinal());
      }
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu)
      {
          getMenuInflater().inflate(R.menu.main, menu);
          return true;
      }
  
      /*
      @Override
      public boolean onPrepareOptionsMenu(Menu menu)
      {
          // if nav drawer is opened, hide the action items
          boolean drawerOpen = mDrawerLayout.isDrawerOpen(mDrawerList);
          menu.findItem(R.id.action_settings).setVisible(!drawerOpen);
          return super.onPrepareOptionsMenu(menu);
      }
      */
  
  
  
      private void displayNavFragment(MainNavItem navItem)
      {
          if(navItem == mCurrentNavItem){
              return;
          }
          Fragment fragment = Fragment.instantiate(this,
                  navItem.getFragClass().getName());
          if(fragment != null){
              getSupportFragmentManager().beginTransaction()
                      .replace(R.id.main, fragment)
                      .commit();
              setCurrentNavItem(navItem);
          }
      }
  
      private void setCurrentNavItem(MainNavItem navItem)
      {
          int position = navItem.ordinal();
          // If navItem is in DrawerAdapter
          if(position &gt;= 0 &amp;&amp; position &lt; mDrawerAdapter.getCount()){
              mDrawerList.setItemChecked(position, true);
          }
          else{
              // navItem not in DrawerAdapter, de-select current item
              if(mCurrentNavItem != null){
                  mDrawerList.setItemChecked(mCurrentNavItem.ordinal(), false);
              }
          }
          mDrawerLayout.closeDrawer(mDrawerList);
          setTitle(navItem.getTitleResId());
          mCurrentNavItem = navItem;
      }
  
  
  
  
      public void goToSearch(MenuItem item){
  
          //go to search page
          Fragment Fragment_one;
          FragmentManager man= getSupportFragmentManager();
          FragmentTransaction tran = man.beginTransaction();
          Fragment_one = new Search();
  
          tran.replace(R.id.main, Fragment_one);//tran.
          tran.addToBackStack(null);
          tran.commit();
  
      }
  
  
  
  }
  </code></pre>