I\'m swapping out the action bar for the tool bar, and I nearly have every piece of the puzzle in place. My issue is specifically if I navigate \'up\' and restore the naviga
Inspired by the solution of Daniel Wilson but you only have to do it once and it is all set.
In my NavigationDrawer
's setUp()
(or you can do it anywhere you are initialising your ActionBarDrawerToggle
instance), I write this code:
mDrawerToggle.setToolbarNavigationClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(!mDrawerToggle.isDrawerIndicatorEnabled()) {
getActivity().onBackPressed();
}
}
});
Now every time android.id.home
is pressed and hamburger sign is not shown, the parent activity's onBackPressed()
is called.