I know this thread is pretty old, but this is one of the best results from Google. I have come back many times to solve this problem. None of the solutions above helped me at all. However, I found a solution that works for me.
Currently my setup looks like a view from inside the viewpager. When you click on one of the views, it creates a new page and scrolls it. It was very fast, but it seems that this is because I called
mViewPager.setCurrentItem(intIndex, true);
from within my OnClickEvent. For some reason, the viewpager doesn't like it, so instead I made this function. It creates a new thread that runs runnable in the user interface thread. This runnable is what tells ViewPager to scroll to a specific element.
public static void scrollToIndex(int index) { final int intIndex = index;
Hope I at least helped someone with this problem. Good luck
Edit: Looking back at my answer, I'm sure you can just run ui on the thread, and it should work. Take it with salt, although I have not tested it yet.
XNiiNJA Jun 19 '15 at 15:39 2015-06-19 15:39
source share