1

I am using the following android library to display a BottomBar in my app: https://github.com/roughike/BottomBar

It's a great library but there's one minor problem that I'm having. I want to show a popup (alertDialog) when the user clicks on a tab. But the problem is that when you click on the tab for the first time, it highlights the tab, and then you have to click it again to get the popup. How can I make it so that I only have to click a tab once for the popup?

Also, one more thing, when the app loads, the first tab is by default activated, how can I prevent that from happening? Thanks in advance!

Below is my code:

BottomBar bottomBar = (BottomBar) findViewById(R.id.bottomBar);
bottomBar.setOnTabReselectListener(new OnTabReselectListener() {
    @Override
    public void onTabReSelected(@IdRes int tabId) {
        if(tabId == R.id.tab_one){
              // alertDialogBuilder
              // show the popup
        } else if (tabId == R.id.two){
              // show another popup
        }
    }
}

Let me know if you want me to post more code. I am mostly using the same code that is posted on that gitHub page.

Parth Bhoiwala
  • 1,282
  • 3
  • 19
  • 44

0 Answers0