ViewPager set current page programmatically












9















I wrote a custom ViewPager to disable Swipe Scroll, but I want to swipe programmatically. I have three Tab in my view pager, but when I call viewPager.setCurrentItem(viewPager.getCurrentItem()+1) on the first Fragment, it moves to the third Fragment instead of the second Fragment. And if I call same function in the second Fragment, it goes to the third. If I call (viewPager.getCurrentItem()-1)` in the third fragment, it works fine by moving back. Any help would be appreciated. My code is below:



NonSwipeAbleViewPager



public class NonSwipeableViewPager extends ViewPager {

private boolean swipeable;

public NonSwipeableViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MyViewPager);
try {
swipeable = a.getBoolean(R.styleable.MyViewPager_swipeable, true);
} finally {
a.recycle();
}
}

@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
return swipeable ? super.onInterceptTouchEvent(event) : false;
}

@Override
public boolean onTouchEvent(MotionEvent event) {
return swipeable ? super.onTouchEvent(event) : false;
}
}


Declaration in XML



<co.example.customview.NonSwipeableViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
app:swipeable="false" />


Calling it



 @Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menuNext:
NonSwipeableViewPager pages = (NonSwipeableViewPager) getActivity().findViewById(R.id.pager);
pages.setCurrentItem(pages.getCurrentItem()+1, true);
break;
default:
return super.onOptionsItemSelected(item);
}
return super.onOptionsItemSelected(item);
}









share|improve this question

























  • are you sure that when you press on the menuNext button the first button you are on the fragment at index 0 ?

    – Blackbelt
    Mar 10 '15 at 16:08











  • I think I remember some similar oddities when working with it like this at some point. I just can't recall what the resolution was.

    – Jay Snayder
    Mar 10 '15 at 16:09











  • Have you tried separating the statements? int currentItem = pages.getCurrentItem(); currentItem++; pages.setCurrentItem(currentItem);

    – John P.
    Mar 10 '15 at 16:14













  • I am. I tried to have it Logged by Log.e("PAGES:", String.valueOf(pager.getCurrentItem())); The funny thing is that, if I am on the second tab and move to the third tab, it doesnt log. But, if I'm on the first and click on the third Tab, it logs the page as 2

    – Abubakar Oladeji
    Mar 10 '15 at 16:15











  • @JohnP. Same thing. Moves to the third page

    – Abubakar Oladeji
    Mar 10 '15 at 16:20


















9















I wrote a custom ViewPager to disable Swipe Scroll, but I want to swipe programmatically. I have three Tab in my view pager, but when I call viewPager.setCurrentItem(viewPager.getCurrentItem()+1) on the first Fragment, it moves to the third Fragment instead of the second Fragment. And if I call same function in the second Fragment, it goes to the third. If I call (viewPager.getCurrentItem()-1)` in the third fragment, it works fine by moving back. Any help would be appreciated. My code is below:



NonSwipeAbleViewPager



public class NonSwipeableViewPager extends ViewPager {

private boolean swipeable;

public NonSwipeableViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MyViewPager);
try {
swipeable = a.getBoolean(R.styleable.MyViewPager_swipeable, true);
} finally {
a.recycle();
}
}

@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
return swipeable ? super.onInterceptTouchEvent(event) : false;
}

@Override
public boolean onTouchEvent(MotionEvent event) {
return swipeable ? super.onTouchEvent(event) : false;
}
}


Declaration in XML



<co.example.customview.NonSwipeableViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
app:swipeable="false" />


Calling it



 @Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menuNext:
NonSwipeableViewPager pages = (NonSwipeableViewPager) getActivity().findViewById(R.id.pager);
pages.setCurrentItem(pages.getCurrentItem()+1, true);
break;
default:
return super.onOptionsItemSelected(item);
}
return super.onOptionsItemSelected(item);
}









share|improve this question

























  • are you sure that when you press on the menuNext button the first button you are on the fragment at index 0 ?

    – Blackbelt
    Mar 10 '15 at 16:08











  • I think I remember some similar oddities when working with it like this at some point. I just can't recall what the resolution was.

    – Jay Snayder
    Mar 10 '15 at 16:09











  • Have you tried separating the statements? int currentItem = pages.getCurrentItem(); currentItem++; pages.setCurrentItem(currentItem);

    – John P.
    Mar 10 '15 at 16:14













  • I am. I tried to have it Logged by Log.e("PAGES:", String.valueOf(pager.getCurrentItem())); The funny thing is that, if I am on the second tab and move to the third tab, it doesnt log. But, if I'm on the first and click on the third Tab, it logs the page as 2

    – Abubakar Oladeji
    Mar 10 '15 at 16:15











  • @JohnP. Same thing. Moves to the third page

    – Abubakar Oladeji
    Mar 10 '15 at 16:20
















9












9








9


1






I wrote a custom ViewPager to disable Swipe Scroll, but I want to swipe programmatically. I have three Tab in my view pager, but when I call viewPager.setCurrentItem(viewPager.getCurrentItem()+1) on the first Fragment, it moves to the third Fragment instead of the second Fragment. And if I call same function in the second Fragment, it goes to the third. If I call (viewPager.getCurrentItem()-1)` in the third fragment, it works fine by moving back. Any help would be appreciated. My code is below:



NonSwipeAbleViewPager



public class NonSwipeableViewPager extends ViewPager {

private boolean swipeable;

public NonSwipeableViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MyViewPager);
try {
swipeable = a.getBoolean(R.styleable.MyViewPager_swipeable, true);
} finally {
a.recycle();
}
}

@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
return swipeable ? super.onInterceptTouchEvent(event) : false;
}

@Override
public boolean onTouchEvent(MotionEvent event) {
return swipeable ? super.onTouchEvent(event) : false;
}
}


Declaration in XML



<co.example.customview.NonSwipeableViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
app:swipeable="false" />


Calling it



 @Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menuNext:
NonSwipeableViewPager pages = (NonSwipeableViewPager) getActivity().findViewById(R.id.pager);
pages.setCurrentItem(pages.getCurrentItem()+1, true);
break;
default:
return super.onOptionsItemSelected(item);
}
return super.onOptionsItemSelected(item);
}









share|improve this question
















I wrote a custom ViewPager to disable Swipe Scroll, but I want to swipe programmatically. I have three Tab in my view pager, but when I call viewPager.setCurrentItem(viewPager.getCurrentItem()+1) on the first Fragment, it moves to the third Fragment instead of the second Fragment. And if I call same function in the second Fragment, it goes to the third. If I call (viewPager.getCurrentItem()-1)` in the third fragment, it works fine by moving back. Any help would be appreciated. My code is below:



NonSwipeAbleViewPager



public class NonSwipeableViewPager extends ViewPager {

private boolean swipeable;

public NonSwipeableViewPager(Context context, AttributeSet attrs) {
super(context, attrs);
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.MyViewPager);
try {
swipeable = a.getBoolean(R.styleable.MyViewPager_swipeable, true);
} finally {
a.recycle();
}
}

@Override
public boolean onInterceptTouchEvent(MotionEvent event) {
return swipeable ? super.onInterceptTouchEvent(event) : false;
}

@Override
public boolean onTouchEvent(MotionEvent event) {
return swipeable ? super.onTouchEvent(event) : false;
}
}


Declaration in XML



<co.example.customview.NonSwipeableViewPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
app:swipeable="false" />


Calling it



 @Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menuNext:
NonSwipeableViewPager pages = (NonSwipeableViewPager) getActivity().findViewById(R.id.pager);
pages.setCurrentItem(pages.getCurrentItem()+1, true);
break;
default:
return super.onOptionsItemSelected(item);
}
return super.onOptionsItemSelected(item);
}






android android-fragments android-viewpager






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 29 '18 at 8:44









Cœur

17.6k9105145




17.6k9105145










asked Mar 10 '15 at 16:05









Abubakar OladejiAbubakar Oladeji

98641233




98641233













  • are you sure that when you press on the menuNext button the first button you are on the fragment at index 0 ?

    – Blackbelt
    Mar 10 '15 at 16:08











  • I think I remember some similar oddities when working with it like this at some point. I just can't recall what the resolution was.

    – Jay Snayder
    Mar 10 '15 at 16:09











  • Have you tried separating the statements? int currentItem = pages.getCurrentItem(); currentItem++; pages.setCurrentItem(currentItem);

    – John P.
    Mar 10 '15 at 16:14













  • I am. I tried to have it Logged by Log.e("PAGES:", String.valueOf(pager.getCurrentItem())); The funny thing is that, if I am on the second tab and move to the third tab, it doesnt log. But, if I'm on the first and click on the third Tab, it logs the page as 2

    – Abubakar Oladeji
    Mar 10 '15 at 16:15











  • @JohnP. Same thing. Moves to the third page

    – Abubakar Oladeji
    Mar 10 '15 at 16:20





















  • are you sure that when you press on the menuNext button the first button you are on the fragment at index 0 ?

    – Blackbelt
    Mar 10 '15 at 16:08











  • I think I remember some similar oddities when working with it like this at some point. I just can't recall what the resolution was.

    – Jay Snayder
    Mar 10 '15 at 16:09











  • Have you tried separating the statements? int currentItem = pages.getCurrentItem(); currentItem++; pages.setCurrentItem(currentItem);

    – John P.
    Mar 10 '15 at 16:14













  • I am. I tried to have it Logged by Log.e("PAGES:", String.valueOf(pager.getCurrentItem())); The funny thing is that, if I am on the second tab and move to the third tab, it doesnt log. But, if I'm on the first and click on the third Tab, it logs the page as 2

    – Abubakar Oladeji
    Mar 10 '15 at 16:15











  • @JohnP. Same thing. Moves to the third page

    – Abubakar Oladeji
    Mar 10 '15 at 16:20



















are you sure that when you press on the menuNext button the first button you are on the fragment at index 0 ?

– Blackbelt
Mar 10 '15 at 16:08





are you sure that when you press on the menuNext button the first button you are on the fragment at index 0 ?

– Blackbelt
Mar 10 '15 at 16:08













I think I remember some similar oddities when working with it like this at some point. I just can't recall what the resolution was.

– Jay Snayder
Mar 10 '15 at 16:09





I think I remember some similar oddities when working with it like this at some point. I just can't recall what the resolution was.

– Jay Snayder
Mar 10 '15 at 16:09













Have you tried separating the statements? int currentItem = pages.getCurrentItem(); currentItem++; pages.setCurrentItem(currentItem);

– John P.
Mar 10 '15 at 16:14







Have you tried separating the statements? int currentItem = pages.getCurrentItem(); currentItem++; pages.setCurrentItem(currentItem);

– John P.
Mar 10 '15 at 16:14















I am. I tried to have it Logged by Log.e("PAGES:", String.valueOf(pager.getCurrentItem())); The funny thing is that, if I am on the second tab and move to the third tab, it doesnt log. But, if I'm on the first and click on the third Tab, it logs the page as 2

– Abubakar Oladeji
Mar 10 '15 at 16:15





I am. I tried to have it Logged by Log.e("PAGES:", String.valueOf(pager.getCurrentItem())); The funny thing is that, if I am on the second tab and move to the third tab, it doesnt log. But, if I'm on the first and click on the third Tab, it logs the page as 2

– Abubakar Oladeji
Mar 10 '15 at 16:15













@JohnP. Same thing. Moves to the third page

– Abubakar Oladeji
Mar 10 '15 at 16:20







@JohnP. Same thing. Moves to the third page

– Abubakar Oladeji
Mar 10 '15 at 16:20














3 Answers
3






active

oldest

votes


















11














In your PagerActivity use



    viewPager = (ViewPager) findViewById(R.id.view_pager);
viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageSelected(int position) {
int pagei = position + 1;
pages=pagei + "";

Toast.makeText(PagerActivity.this, getString(R.string.changeinfopage) + " " + pages, Toast.LENGTH_SHORT).show();
}

@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}

@Override
public void onPageScrollStateChanged(int state) {
}
});


and



    @Override
public boolean onOptionsItemSelected(MenuItem item) {


switch (item.getItemId()) {

case R.id.action_previous:

viewPager.setCurrentItem(viewPager.getCurrentItem() - 1);
return true;

case R.id.action_next:

viewPager.setCurrentItem(viewPager.getCurrentItem() + 1);
return true;
}

return super.onOptionsItemSelected(item);

}





share|improve this answer































    16














    viewPager.setCurrentItem(idx);


    where idx is 0 based integer.






    share|improve this answer
























    • The Question is ViewPager set current page programatically , thus this should be the accepted answer!

      – Yahya
      Mar 30 '18 at 20:15



















    1














    try this :



      viewPager.postDelayed(new Runnable() {

    @Override
    public void run() {
    viewPager.setCurrentItem(position);
    }
    }, 10);


    sometimes, setCurrentItem on viewpager doesn't work. As pager's content was controlled by a spinner. both the spinners and the pagers state were restored onResume, and because of this the spinners onItemSelected listener was called during the next event propagation cycle.



    By using handler we can make this work because it set the pagers current position after the onItemSelected event fired.






    share|improve this answer























      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f28968512%2fviewpager-set-current-page-programmatically%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      3 Answers
      3






      active

      oldest

      votes








      3 Answers
      3






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      11














      In your PagerActivity use



          viewPager = (ViewPager) findViewById(R.id.view_pager);
      viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
      @Override
      public void onPageSelected(int position) {
      int pagei = position + 1;
      pages=pagei + "";

      Toast.makeText(PagerActivity.this, getString(R.string.changeinfopage) + " " + pages, Toast.LENGTH_SHORT).show();
      }

      @Override
      public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
      }

      @Override
      public void onPageScrollStateChanged(int state) {
      }
      });


      and



          @Override
      public boolean onOptionsItemSelected(MenuItem item) {


      switch (item.getItemId()) {

      case R.id.action_previous:

      viewPager.setCurrentItem(viewPager.getCurrentItem() - 1);
      return true;

      case R.id.action_next:

      viewPager.setCurrentItem(viewPager.getCurrentItem() + 1);
      return true;
      }

      return super.onOptionsItemSelected(item);

      }





      share|improve this answer




























        11














        In your PagerActivity use



            viewPager = (ViewPager) findViewById(R.id.view_pager);
        viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
        int pagei = position + 1;
        pages=pagei + "";

        Toast.makeText(PagerActivity.this, getString(R.string.changeinfopage) + " " + pages, Toast.LENGTH_SHORT).show();
        }

        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
        }

        @Override
        public void onPageScrollStateChanged(int state) {
        }
        });


        and



            @Override
        public boolean onOptionsItemSelected(MenuItem item) {


        switch (item.getItemId()) {

        case R.id.action_previous:

        viewPager.setCurrentItem(viewPager.getCurrentItem() - 1);
        return true;

        case R.id.action_next:

        viewPager.setCurrentItem(viewPager.getCurrentItem() + 1);
        return true;
        }

        return super.onOptionsItemSelected(item);

        }





        share|improve this answer


























          11












          11








          11







          In your PagerActivity use



              viewPager = (ViewPager) findViewById(R.id.view_pager);
          viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
          @Override
          public void onPageSelected(int position) {
          int pagei = position + 1;
          pages=pagei + "";

          Toast.makeText(PagerActivity.this, getString(R.string.changeinfopage) + " " + pages, Toast.LENGTH_SHORT).show();
          }

          @Override
          public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
          }

          @Override
          public void onPageScrollStateChanged(int state) {
          }
          });


          and



              @Override
          public boolean onOptionsItemSelected(MenuItem item) {


          switch (item.getItemId()) {

          case R.id.action_previous:

          viewPager.setCurrentItem(viewPager.getCurrentItem() - 1);
          return true;

          case R.id.action_next:

          viewPager.setCurrentItem(viewPager.getCurrentItem() + 1);
          return true;
          }

          return super.onOptionsItemSelected(item);

          }





          share|improve this answer













          In your PagerActivity use



              viewPager = (ViewPager) findViewById(R.id.view_pager);
          viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
          @Override
          public void onPageSelected(int position) {
          int pagei = position + 1;
          pages=pagei + "";

          Toast.makeText(PagerActivity.this, getString(R.string.changeinfopage) + " " + pages, Toast.LENGTH_SHORT).show();
          }

          @Override
          public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
          }

          @Override
          public void onPageScrollStateChanged(int state) {
          }
          });


          and



              @Override
          public boolean onOptionsItemSelected(MenuItem item) {


          switch (item.getItemId()) {

          case R.id.action_previous:

          viewPager.setCurrentItem(viewPager.getCurrentItem() - 1);
          return true;

          case R.id.action_next:

          viewPager.setCurrentItem(viewPager.getCurrentItem() + 1);
          return true;
          }

          return super.onOptionsItemSelected(item);

          }






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 10 '15 at 18:49









          eurosecomeurosecom

          1,50921328




          1,50921328

























              16














              viewPager.setCurrentItem(idx);


              where idx is 0 based integer.






              share|improve this answer
























              • The Question is ViewPager set current page programatically , thus this should be the accepted answer!

                – Yahya
                Mar 30 '18 at 20:15
















              16














              viewPager.setCurrentItem(idx);


              where idx is 0 based integer.






              share|improve this answer
























              • The Question is ViewPager set current page programatically , thus this should be the accepted answer!

                – Yahya
                Mar 30 '18 at 20:15














              16












              16








              16







              viewPager.setCurrentItem(idx);


              where idx is 0 based integer.






              share|improve this answer













              viewPager.setCurrentItem(idx);


              where idx is 0 based integer.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Jul 25 '17 at 15:16









              Alp AltunelAlp Altunel

              745816




              745816













              • The Question is ViewPager set current page programatically , thus this should be the accepted answer!

                – Yahya
                Mar 30 '18 at 20:15



















              • The Question is ViewPager set current page programatically , thus this should be the accepted answer!

                – Yahya
                Mar 30 '18 at 20:15

















              The Question is ViewPager set current page programatically , thus this should be the accepted answer!

              – Yahya
              Mar 30 '18 at 20:15





              The Question is ViewPager set current page programatically , thus this should be the accepted answer!

              – Yahya
              Mar 30 '18 at 20:15











              1














              try this :



                viewPager.postDelayed(new Runnable() {

              @Override
              public void run() {
              viewPager.setCurrentItem(position);
              }
              }, 10);


              sometimes, setCurrentItem on viewpager doesn't work. As pager's content was controlled by a spinner. both the spinners and the pagers state were restored onResume, and because of this the spinners onItemSelected listener was called during the next event propagation cycle.



              By using handler we can make this work because it set the pagers current position after the onItemSelected event fired.






              share|improve this answer




























                1














                try this :



                  viewPager.postDelayed(new Runnable() {

                @Override
                public void run() {
                viewPager.setCurrentItem(position);
                }
                }, 10);


                sometimes, setCurrentItem on viewpager doesn't work. As pager's content was controlled by a spinner. both the spinners and the pagers state were restored onResume, and because of this the spinners onItemSelected listener was called during the next event propagation cycle.



                By using handler we can make this work because it set the pagers current position after the onItemSelected event fired.






                share|improve this answer


























                  1












                  1








                  1







                  try this :



                    viewPager.postDelayed(new Runnable() {

                  @Override
                  public void run() {
                  viewPager.setCurrentItem(position);
                  }
                  }, 10);


                  sometimes, setCurrentItem on viewpager doesn't work. As pager's content was controlled by a spinner. both the spinners and the pagers state were restored onResume, and because of this the spinners onItemSelected listener was called during the next event propagation cycle.



                  By using handler we can make this work because it set the pagers current position after the onItemSelected event fired.






                  share|improve this answer













                  try this :



                    viewPager.postDelayed(new Runnable() {

                  @Override
                  public void run() {
                  viewPager.setCurrentItem(position);
                  }
                  }, 10);


                  sometimes, setCurrentItem on viewpager doesn't work. As pager's content was controlled by a spinner. both the spinners and the pagers state were restored onResume, and because of this the spinners onItemSelected listener was called during the next event propagation cycle.



                  By using handler we can make this work because it set the pagers current position after the onItemSelected event fired.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered May 28 '18 at 9:14









                  Ajay ChauhanAjay Chauhan

                  217215




                  217215






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Stack Overflow!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f28968512%2fviewpager-set-current-page-programmatically%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Monofisismo

                      Angular Downloading a file using contenturl with Basic Authentication

                      Olmecas