title: How to deselect all the tabs of TabLayout in Android because of option menu?
body: <p>I am developing an Android app. I am using TabLayout for tabs. But I am not using pager view for fragment on tab selected. Instead I am replacing fragment on event listener to a view. I want to deselect all the tabs when an item in option menu is selected. But I saw an identical question in Stack Overflow. The answer is cannot do this. Because a tab must be selected.</p>
  
  <p>This is UI design of my app:</p>
  
  <p><a href="https://i.stack.imgur.com/T1jzx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/T1jzx.png" alt="enter image description here"></a></p>
  
  <p>As you can see in above design, PODCASTS tab is selected by default. This is where the issue begins.</p>
  
  <p>Here are the screenshot of my option menu and function</p>
  
  <p><a href="https://i.stack.imgur.com/v9vVH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/v9vVH.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/n8iZX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/n8iZX.png" alt="enter image description here"></a></p>
  
  <p>The problem is when I select the settings while I am on PODCASTS tab, settings fragment is replaced. But the PODCASTS tab is still selected. But when I click again on, podcasts list fragment is not replaced back. How can I solve that problem ?</p>
  
  <p>This is how I am adding tabs to tab layout in MainActivity:</p>
  
  <pre><code>private void setupTabs() {
          tabLayout.addTab(tabLayout.newTab().setText("Podcasts"));
          tabLayout.addTab(tabLayout.newTab().setText("Playlist"));
          tabLayout.addTab(tabLayout.newTab().setText("Downloads"));
          tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
              @Override
              public void onTabSelected(TabLayout.Tab tab) {
                  switch (tab.getPosition()){
                      case 1:
                          setPlaylistFragment();
                          commitFragment();
                          break;
                      case 2:
                          setDownloadsFragment();
                          commitFragment();
                          break;
                      default:
                          setPodcastListFragment(0, getResources().getString(R.string.app_name), "ALL_FRAGMENT");
                          commitFragment();
                          break;
                  }
              }
  
              @Override
              public void onTabUnselected(TabLayout.Tab tab) {
  
              }
  
              @Override
              public void onTabReselected(TabLayout.Tab tab) {
  
              }
          });
      }
  </code></pre>