Code example for ActionBarDrawerToggle

Methods: getSupportActionBar, invalidateOptionsMenu

0
         
        drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, R.drawable.ic_drawer, R.string.drawer_open, R.string.drawer_close){
        	 
            /** Called when a drawer has settled in a completely closed state. */ 
            public void onDrawerClosed(View view) {
                getSupportActionBar().setTitle(title);
                invalidateOptionsMenu();
            } 
 
            /** Called when a drawer has settled in a completely open state. */ 
            public void onDrawerOpened(View drawerView) {
                getSupportActionBar().setTitle(drawerTitle);
                invalidateOptionsMenu();
            } 
        }; 
         
        drawerLayout.setDrawerListener(drawerToggle);
         
        drawerToggle.setDrawerIndicatorEnabled(true);
        drawerToggle.syncState();
	}