I'm developing an app, which has three activities; you can switch the activities using a bottom bar. However, whenever I switch the activity, the bottom bar highlights the first element, and not the element correspondent to the activity I chose.
That's what I want:
And that's what happens:
I could use fragments, but I have to re-create all my project; also, I method that I'm using is not working even if I change it in a fragment.
How can I resolve my problem without using fragments? How can I highlight the element in the bottom bar?
Thanks for your replies!
Use this code to onResume()
of activity. So whenever activity started that item will be selected already.
mBottomNavigationView.getMenu().getItem(index).setChecked(true);
index
refer to menu item number 0-2(Because you have three items). In your case for setting index should be 1 for setting.