I'm wondering how one could restore the state of a BottomNavigationView (android.support.design.widget.BottomNavigationView).
I tried to call bottomNavigationView.getMenu().findItem(restoredItemId).setChecked(true); but this does not result in a correct state inside BottomNavigationView, it only highlights the found item.
I also found below methods, but those don't seem to help much:
((BottomNavigationMenu) bottomNavigationView.getMenu()).savePresenterStates(state);
((BottomNavigationMenu) bottomNavigationView.getMenu()).saveActionViewStates(state);
((BottomNavigationMenu) bottomNavigationView.getMenu()).restorePresenterStates(state);
((BottomNavigationMenu) bottomNavigationView.getMenu()).restoreActionViewStates(state);
I've used the code below to select item programmatically:
View view = bottomNavigationView.findViewById(R.id.menu_action_dashboard);
view.performClick();
Seems like it should work in your case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With