Code example for ActionBarDrawerToggle

Methods: getActionBar, invalidateOptionsMenu

1
		drawerLayout = (DrawerLayout) findViewById(R.id.navigation_drawer);
		actionBarDrawerToggle = new ActionBarDrawerToggle(MainActivity.this,
				drawerLayout, R.drawable.ic_launcher, R.string.app_name,
				R.string.hello_world) { 
			public void onDrawerClosed(View view) {
				getActionBar().setTitle("Close");
				invalidateOptionsMenu();
			} 
 
			public void onDrawerOpened(View drawerView) {
				getActionBar().setTitle("Open");
				invalidateOptionsMenu();
			} 
		}; 
 
		drawerLayout.setDrawerListener(actionBarDrawerToggle);
	} 
 
	private class DrawerItemListener implements OnItemClickListener {
 
		@Override