title: how to change textview's text dynamically when swiping the view pager?
body: <p>I am having a textview above the viewpager. i want to change the text of the textview while swiping the view pager.</p>
  
  <p><strong>Below is exactly what is needed in my case:</strong></p>
  
  <p>viewpager page1 ----> textview's text TEXT1</p>
  
  <p>viewpager page2 ----> textview's text TEXT2</p>
  
  <p>viewpager page3 ----> textview's text TEXT3</p>
  
  <p>viewpager page4 ----> textview's text TEXT4</p>
  
  <p><strong>when i am swiping back</strong> </p>
  
  <p>viewpager page4 ----> textview's text TEXT4</p>
  
  <p>viewpager page3 ----> textview's text TEXT3</p>
  
  <p>viewpager page2 ----> textview's text TEXT2</p>
  
  <p>viewpager page1 ----> textview's text TEXT1</p>
  
  <p><strong>Currently I am setting the text of the textview in below method:</strong></p>
  
  <pre><code>        @Override
      public CharSequence getPageTitle(int position) {
  
          switch (position) {
          case 0:
              mytextview.setText(TEXT1);
              return "TITLE1";
          case 1:
              mytextview.setText(TEXT2);
              return "TITLE2";
          case 2:
              mytextview.setText(TEXT3);
              return "TITLE3";
          case 3:
              mytextview.setText(TEXT4);
              return "TITLE4";
          }
          return null;
      }
  </code></pre>
  
  <p>Using this method I am able to set the text of mytextview for page 2,3,4.
  For page1 I am not able to set the text as shown in above method. Instead it is setting page2' textview text.</p>
  
  <p>why this is happening? and anyone give the solution for this problem.
  where should I set the textview's text(view is above view pager) when i am using the view pager.</p>