Closed vipinhelloindia closed 10 years ago
Please see pull request #15 for this fix.
I have this fix, but still get an infinite for(); loop entry on about half of my calls to setCurrentItem();
Infinite for loop on some of your calls to setCurrentItem()? The fix essentially forwards the params of overloaded methodsetCurrenItem(int, boolean)
to the original method setCurrenItem(int)
. Could you post more details of your issue?
@Override
public void setCurrentItem(int item) {
// offset the current item to ensure there is space to scroll
setCurrentItem(item, false);
}
@Override
public void setCurrentItem(int item, boolean smoothScroll) {
item = getOffsetAmount() + (item % getAdapter().getCount());
super.setCurrentItem(item, smoothScroll);
}
I have 4 fragments. There are links from fragment0 to the 3 other fragments, and then a "BACK" link to fragment0 from the other fragments. It is a bit hit and miss as to whether you will get across or back to the main fragment or not. Half of the time it works and the other half of the time you hit the infinite loop and after 20 seconds you get the system isn't responding wait/ok/report dialogue.
It was reported on stackoverflow that it failed if the transition was from a lower to a higher virtual position number, but I'm not sure it was thas simple.
Do you see the same issue if you use setCurrentItem(int item)
?