I am using a Navigation Drawer and the hamburger menu is showing in all the right screens, but on the other fragments, when I click on the back arrow, the navigation drawer opens when I want to go back in the stack to the previous screen.
How do I change the behavior so that when the arrow is showing, as opposed to the hamburger menu, I can capture the user clicking on the arrow?
I am using a Navigation Drawer with Fragments. In the main activity I am setting the top level destinations with the AppBarConfiguration:
AppBarConfiguration config = new AppBarConfiguration.Builder(topLevelDestinations)
.setDrawerLayout(drawerLayout)
.build();
NavigationUI.setupActionBarWithNavController(this, navController, config);
NavigationUI.setupWithNavController(navView, navController);
navView.setNavigationItemSelectedListener(this);
I am catching all the selections from the top level destinations and navigating appropriately:
@Override
public boolean onNavigationItemSelected(@NonNull MenuItem item) {
item.setChecked(true);
drawerLayout.closeDrawers();
int id = item.getItemId();
switch (id) {
...
}
drawerLayout.closeDrawer(GravityCompat.START);
return true;
}