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
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.