Skip to content
Advertisement

Disable reselecting in BottomNavigationView

How can I disable reloading fragment when clicking again on the current tab in BottomNavigationView?

In other words how to disable re-selection in BottomNavigationView?

PS: I’m using NavigationUI to setup BottomNavigationView

Advertisement

Answer

It was surprisingly simple!

    NavigationUI.setupWithNavController(bottomNavigationView, hostNavController);
    bottomNavigationView.setOnNavigationItemReselectedListener(new BottomNavigationView.OnNavigationItemReselectedListener() {
        @Override
        public void onNavigationItemReselected(@NonNull MenuItem item) {
            // Nothing here to disable reselect
        }
    });
Advertisement