title: ViewPager hide button when a specific page is displayed
body: <p>Hey im trying to hide a button in my layout when a specfic page is displayed. I used the following code but it didnt seem to work for me. Any help is appriciated :)</p>
  
  <pre><code>@Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.app_intro);
  
      mAdapter = new FragmentAdapter(getSupportFragmentManager());
  
      mPager = (ViewPager) findViewById(R.id.pager);
      final Button next = (Button) findViewById(R.id.intro_next);
      final Button skip = (Button) findViewById(R.id.intro_skip);
  
      mPager.setAdapter(mAdapter);
  
      mPager.setOnPageChangeListener(new OnPageChangeListener() {
          public void onPageScrollStateChanged(int state) {}
          public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {}
          public void onPageSelected(int position) {
              next.setVisibility(View.GONE);
          }
      });
  
      next.setOnClickListener(new OnClickListener() {
          public void onClick(View v) {
              mPager.setCurrentItem(mPager.getCurrentItem() + 1);
          }
      });
  
      skip.setOnClickListener(new OnClickListener() {
          public void onClick(View v) {
              mPager.setCurrentItem(5);
          }
      });
  
      UnderlinePageIndicator indicator = (UnderlinePageIndicator) findViewById(R.id.indicator);
      mIndicator = indicator;
      indicator.setViewPager(mPager);
      indicator.setBackgroundColor(0xFFCCCCCC);
      indicator.setFades(false);
  }
  </code></pre>