If you have this code in Activity onCreate():
mViewPager = new ViewPager(this, null);
mPagerAdapter = new PagerAdapter(this);
mViewPager.setAdapter(mPagerAdapter);
mCirclePageIndicator.setViewPager(mViewPager);
mCirclePageIndicator.setOnPageChangeListener(onPageChangeListener);
Then launch an AsyncTask and want to change the current page in it's onPostExecute() with the page 0, then it won't work. It works with any other page != 0, but with 0 it just retains the current position.
mCirclePageIndicator.setCurrentItem(0);
If anybody comes up with an idea, feel free to share. Thanks !
Workaround:
First set another page as the current page, then set to page 0. Yes, I know, it's retarded, but I still haven't found an explication as to why it isn't working in the first place. I've tried posting it in a Handler, even with a delay, but nothing. Nada.
mCirclePageIndicator.setCurrentItem(1);
mCirclePageIndicator.setCurrentItem(0);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With