I have a bottom navigation, I check the selected item on its selection, and this prevent it from re selecting the same item again.
So if I am on the home screen and I click home screen navigation item again, it does not do anything.
I have a case where I need to make home navigation item selectable even if its already selected.
This is my code that I run in onCreate method.
public void updateNavigationBarState() {
int actionId = getNavigationMenuItemId();
selectBottomNavigationBarItem(actionId);
}
void selectBottomNavigationBarItem(int itemId) {
Menu menu = bottomNavigationView.getMenu();
for (int i = 0, size = menu.size(); i < size; i++) {
MenuItem item = menu.getItem(i);
boolean shouldBeChecked = item.getItemId() == itemId;
if (shouldBeChecked) {
item.setChecked(true);
item.setEnabled(false);
break;
}
}
}
Is there any way to make item clickable even if its selected.