title: Android TabLayout With Swipeable Views Button Click From One Fragment To Another Fragment
body: <p>I am following this tutorial: <a href="http://www.androidhive.info/2013/10/android-tab-layout-with-swipeable-views-1/" rel="nofollow">androidhive - tab layout with swipe able views</a>. I would like to have a button on the first tab fragment and link it over to the second tab fragment. may i have some guide on how to go about doing this? all the fragments have different layouts. </p>
  
  <p>I am currently using this method in the first tab fragment, it works!</p>
  
  <pre><code>        btn.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              ((mainActivity)getActivity()).viewPager.setCurrentItem(2); //position of tab3 = 2
          }
      });
  </code></pre>