title: How to hide a view at a specific ViewPager page? Please see details
body: <p>There's an <code>ImageView</code> which is actually a right arrow. I'm using it to navigate through <code>ViewPager</code>'s pages.</p>
  
  <p><strong>What I want is I want to hide this <code>ImageView</code> (right arrow) as soon as I navigate to the last (6th) page of the <code>ViewPager</code></strong>.</p>
  
  <p><strong>Here's is what I have done so far to accomplish it</strong>:</p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
          requestWindowFeature(Window.FEATURE_NO_TITLE);
          getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                  WindowManager.LayoutParams.FLAG_FULLSCREEN);
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_walkthroughs);
          // Create the adapter that will return a fragment for each of the three
          // primary sections of the activity.
          mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
  
          // Set up the ViewPager with the sections adapter.
          mViewPager = (ViewPager) findViewById(R.id.container);
          mViewPager.setAdapter(mSectionsPagerAdapter);
  
          ImageView imageView = (ImageView) findViewById(R.id.right_arrow);
          imageView.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  mViewPager.setCurrentItem(mViewPager.getCurrentItem() + 1);
              }
          });
  
          **here is my code**
          if (mViewPager.getCurrentItem() == 6) {
              imageView.setVisibility(View.GONE);
          }
  
      } 
  </code></pre>
  
  <p><strong>Here's <code>activity_walkthroughs.xml</code> file code</strong>:</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
      &lt;RelativeLayout
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          xmlns:android="http://schemas.android.com/apk/res/android"
          android:orientation="vertical"&gt;
  
      &lt;android.support.design.widget.CoordinatorLayout
  android:id="@+id/main_content"
                                                       xmlns:android="http://schemas.android.com/apk/res/android"
                                                       xmlns:app="http://schemas.android.com/apk/res-auto"
                                                       xmlns:tools="http://schemas.android.com/tools"
                                                       android:layout_width="match_parent"
                                                       android:layout_height="match_parent"
                                                       android:fitsSystemWindows="true"
                                                       tools:context="com.abc.xyz.Walkthroughs"&gt;
  
          &lt;android.support.v4.view.ViewPager
              android:id="@+id/container"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              app:layout_behavior="@string/appbar_scrolling_view_behavior"/&gt;
  
      &lt;/android.support.design.widget.CoordinatorLayout&gt;
  
          &lt;RelativeLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_alignParentBottom="true"
              android:background="@color/colorPrimary"&gt;
  
              &lt;View
                  android:layout_width="1dp"
                  android:layout_height="@dimen/viewpagerindicator_height"
                  android:background="@android:color/white"
                  android:layout_alignParentTop="true"
                  android:layout_alignLeft="@+id/right_arrow"
                  android:layout_alignStart="@+id/right_arrow"/&gt;
  
              &lt;ImageView
                  android:id="@+id/right_arrow"
                  android:layout_width="wrap_content"
                  android:layout_height="@dimen/viewpagerindicator_height"
                  android:layout_alignParentRight="true"
                  android:layout_alignParentEnd="true"
                  android:background="@drawable/btn_touch_feedback_impression"
                  android:src="@drawable/ic_action_right_arrow"/&gt;
  
          &lt;/RelativeLayout&gt;
  
      &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>The problem is that this code is not doing the job.</p>
  
  <p>Please let me know where is the problem!</p>
  
  <p>Thanks in advance.</p>