BottomBar
BottomBar copied to clipboard
open third tab onstart
trafficstars
Assume I have five items in my menu. So I just want to open third tab on starting of the app. Currently it actually starts the first tab. So how to get third tab to be opened onstart?
just call bottomBar.selectTabAtPosition(2); before you set bottomBar.setOnTabSelectListener
Not working...if call that before .setOnTabSelectListener , it is saying app is stopped unfortunately.
Hmm... But it's working for me. I did this way: `
bottomBar = findViewById(R.id.bottomBar);
bottomBar.selectTabAtPosition(1);
bottomBar.setOnTabSelectListener(new OnTabSelectListener() {
@Override
public void onTabSelected(@IdRes int tabId) {
switch (tabId) {
case R.id.tab_home:
<some code>
case R.id.tab_profile:
<some code>
}
}
});`
Can you provide a stack trace? Maybe your app simply catches nullpointerexception?