I implemented a bottom navigation bar with multiple fragments.  When selecting each view, I added the fragment to the back stack with transaction.addToBackStack(null).   However, when I pressed the back button the fragments switched but the menu item in the navigation bar would not highlight.

 

Apparently, Material design guidelines state “On Android, the Back button does not navigate between bottom navigation bar views.”

 

As a result I needed to remove the call to addToBackStack as the proper behavior is for the back button to go to the previous app or activity.

Android Back button does not navigate between bottom navigation bar views

Leave a Reply

Translate »