title: How to set up a DrawerLayout toggle button in Android?
body: <p>I have a DrawerLayout used as a navigation tab. I have everything set up, but now I need a small button that would open it and close it (ActionBarToggle, or something like that). How can I set it up as simply as possible? (Im a relative beginner, so I'm not handling this very well)</p>
  
  <p>it just needs to be a button in the top left corner (like the one the youtube app has) that toggles the drawer open and closed.</p>
  
  <p>Edit: I'm adding my code for the drawer:</p>
  
  <pre><code>     public class MainActivity extends ActionBarActivity {
  
  
   private DrawerLayout mDrawerLayout;
      private ListView mDrawerList;
      /***/
      public NavDrawerListAdapter navDrawerListAdapter;
     Fragment fragment;
          @Override
      protected void onCreate(Bundle savedInstanceState) {
              categoryItems = new ArrayList&lt;CategoryItem&gt;();
              categoryItems.populate();
             navDrawerListAdapter = new NavDrawerListAdapter(this, categoryItems);
      mDrawerList.addHeaderView(listheader, null, false);
          // Set the list's click listener
          mDrawerList.setOnItemClickListener(new DrawerItemClickListener());    mDrawerLayout = (DrawerLayout) findViewById(R.id.drawer_layout);
          mDrawerList = (ListView) findViewById(R.id.left_drawer);
  
     }
  }
  </code></pre>
  
  <p>Among other things, there is a simple Adapter (NavDrawerListAdapter), and a simple JavaBean CategoryItem. There is also a small function populate() which simply adds a few elements to the list. All of those function perfectly. All I need now is a toggle button in the top left corner to open and close the navigation drawer.</p>