architecture-components-samples icon indicating copy to clipboard operation
architecture-components-samples copied to clipboard

second tap on bottomNavView tab - NavigationAdvancedSample

Open SogoGolf opened this issue 7 years ago • 3 comments

ive implemented the recommended workaround provided here for maintaining state on each tab when using the navigation component. https://github.com/googlesamples/android-architecture-components/tree/master/NavigationAdvancedSample

that works nicely. however - if a user taps TWICE on the same tab - then all of that back stack is removed completely and the tab's back stack resets itself!

it might be expected behaviour (resetting a tab's back stack on 2nd tap) - however, how can we prevent this 'second tap' behaviour as it totally negates the provided workaround ?

SogoGolf avatar Aug 08 '19 00:08 SogoGolf

I am facing the same issue, anyone, please update on this.

ummerakbar45 avatar Sep 13 '19 07:09 ummerakbar45

@SogoGolf navController.addOnDestinationChangedListener(new NavController.OnDestinationChangedListener() { @Override public void onDestinationChanged(@NonNull NavController controller, @NonNull NavDestination destination, @Nullable Bundle arguments) { **findViewById(bottomNavigationView.getSelectedItemId()).setEnabled(false);** });

Disabled selected tab works for me

ummerakbar45 avatar Sep 13 '19 10:09 ummerakbar45

This was fixed in #578

ianhanniballake avatar Jan 26 '20 23:01 ianhanniballake