Code example for ActionBarDrawerToggle

Methods: getSupportActionBar, invalidateOptionsMenu

0
                R.drawable.ic_drawer,  /* nav drawer image to replace 'Up' caret */ 
                R.string.drawer_open,  /* "open drawer" description for accessibility */ 
                R.string.drawer_close  /* "close drawer" description for accessibility */ 
        ) { 
            public void onDrawerClosed(View view) {
                getSupportActionBar().setTitle(mTitle);
                invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() 
            } 
 
            public void onDrawerOpened(View drawerView) {
                getSupportActionBar().setTitle(mDrawerTitle);
                invalidateOptionsMenu(); // creates call to onPrepareOptionsMenu() 
            } 
        }; 
        mDrawerLayout.setDrawerListener(mDrawerToggle);
    } 
 
    @Override 
    public boolean onOptionsItemSelected(MenuItem item) {
        // The action bar home/up action should open or close the drawer. 
        // ActionBarDrawerToggle will take care of this.