I have implemented a custom toolbar and made it as an actionbar.
mToolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(mToolbar);
mDrawerLayout = (android.support.v4.widget.DrawerLayout)
findViewById(R.id.drawer_layout);
mDrawerToggle = new ActionBarDrawerToggle(
this, mDrawerLayout, mToolbar,
R.string.drawer_open,R.string.drawer_close
){
public void onDrawerClosed(View view)
{super.onDrawerClosed(view);
invalidateOptionsMenu();
syncState();
}
public void onDrawerOpened(View drawerView)
{super.onDrawerOpened(drawerView);
invalidateOptionsMenu();
syncState();
} };
mDrawerLayout.setDrawerListener(mDrawerToggle);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
mDrawerToggle.syncState();
But when the current fragment is replaced with a new fragment , the hamburger icon is not changing to back arrow. But when switching to new activity, the back arrow is coming correctly. Does anyone know what is missing here?
Any help appreciated.