Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

open third tab onstart #879

Open
rajesh-codes opened this issue Dec 2, 2017 · 3 comments
Open

open third tab onstart #879

rajesh-codes opened this issue Dec 2, 2017 · 3 comments

Comments

@rajesh-codes
Copy link

rajesh-codes commented Dec 2, 2017

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?

@rajesh-codes rajesh-codes changed the title open third fragment onstart open third tab onstart Dec 2, 2017
@MadAxon
Copy link

MadAxon commented Dec 6, 2017

just call bottomBar.selectTabAtPosition(2); before you set bottomBar.setOnTabSelectListener

@rajesh-codes
Copy link
Author

Not working...if call that before .setOnTabSelectListener , it is saying app is stopped unfortunately.

@MadAxon
Copy link

MadAxon commented Dec 6, 2017

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants