title: How to get current selected tab index in TabLayout?
body: <p>When I use ActionBar tabs, I use this code.</p>
  
  <pre><code>private int getCurrentTabIndex() {
      ActionBar actionBar = activity.getSupportActionBar();
      ActionBar.Tab selectedTab = actionBar.getSelectedTab();
      if(selectedTab == null){
          return 0;
      }
  
      return selectedTab.getPosition();
  }
  </code></pre>
  
  <p>But how can I do it using TabLayout?</p>