Android – Change drawer icon back to back arrow

androidnavigation-drawer

I'm using the new DrawerLayout to have side navigation. I'm using the drawer icon (the 'hamburger') like this:

@Override
protected void onStart() {
    super.onStart();

    mDrawerLayout = (DrawerLayout) findViewById(R.id.activity_main_drawerlayout);
    mDrawerToggle = new ActionBarDrawerToggle(
            this, 
            mDrawerLayout, 
            R.drawable.ic_navigation_drawer, 
            R.string.app_name, 
            R.string.app_name);
    mDrawerLayout.setDrawerListener(mDrawerToggle);

    getActionBar().setDisplayHomeAsUpEnabled(true);
    getActionBar().setHomeButtonEnabled(true);
}

However, when I add a Fragment to the backstack, I want to display the back arrow again, so the user can navigate back to "home", and only then open the app drawer.

How can I reset the drawer icon to the back icon?
The arrow I want:

Navigation Drawer

Best Answer

To disable and hide the DrawerToggle "Hamburger", just call

mDrawerToggle.setDrawerIndicatorEnabled(false);