I\'ve started working with the new navigation component and I\'m really digging it! I do have one issue though - How am I supposed to handle the back button when I\'m at the
Override onBackPressed in your activity and check if the current destination is the start destination or not.
Practically it looks like this:
@Override
public void onBackPressed() {
if (Navigation.findNavController(this,R.id.nav_host_fragment)
.getCurrentDestination().getId() == R.id.your_start_destination) {
// handle back button the way you want here
return;
}
super.onBackPressed();
}