title: Change the tabs text title in dynamic
body: <p>I have a tablayout with four tabs under viewpager. I want to change the text title when i slide the tab. My problem is i can't handle tab respectively. </p>
  
  <p>For instance the four tabs title are 1、2、3、4 , when i slide it will show like 1、9、3、4 or 1、2、9、4...</p>
  
  <p>but it is 7、9、7、7 or 7、7、9、7...in my case</p>
  
  <p>I try to write it on onTabUnselected function . Obviously i don't have the variable to control it.</p>
  
  <p>What can i do next ? </p>
  
  <p>Part of the program:</p>
  
  <pre><code>private ViewPager viewPager;
  
  viewPager.addOnPageChangeListener(new TabLayout.TabLayoutOnPageChangeListener(tabLayoutHomePage));
          tabLayoutHomePage.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
              @Override
              public void onTabSelected(TabLayout.Tab tab) {
                  int id=tab.getPosition();
                  switch (id){
                      case 0:
                          tab.setText("9");
                          break;
                      case 1:
                          tab.setText("9");
                          break;
                      case 2:
                          tab.setText("9");
                          break;
                      case 3:
                          tab.setText("9");
                          break;
                  }
                      viewPager.setCurrentItem(tab.getPosition());
              }
  
              @Override
              public void onTabUnselected(TabLayout.Tab tab) {
                  int id=tab.getPosition();
                  switch (id){
                      case 0:
                          tab.setText("7");
                          break;
                      case 1:
                          tab.setText("7");
                          break;
                      case 2:
                          tab.setText("7");
                          break;
                      case 3:
                          tab.setText("7");
                          break;
                  }
              }
  
              @Override
              public void onTabReselected(TabLayout.Tab tab) {
  
              }
          }); 
  </code></pre>
  
  <p>The original declare four tabs title</p>
  
  <pre><code>tabLayoutHomePage = (TabLayout) view.findViewById(R.id.tabLayoutHomePage);
      tabLayoutHomePage.addTab(tabLayoutHomePage.newTab().setText(R.string.bloodPressure));
      tabLayoutHomePage.addTab(tabLayoutHomePage.newTab().setText(R.string.bloodSugar));
      tabLayoutHomePage.addTab(tabLayoutHomePage.newTab().setText(R.string.bodyWeight));
      tabLayoutHomePage.addTab(tabLayoutHomePage.newTab().setText(R.string.vaccine));
      tabLayoutHomePage.setTabGravity(TabLayout.GRAVITY_FILL);
  </code></pre>