I figured it out. In the InfinitePagerAdapter class I just changed the return value of getCount() method.
@Override
public int getCount() {
return Integer.MAX_VALUE;
}
Integer.MAX_VALUE was too big of a value so scale it down to 3000:
return 3000;//Or something similar
The problem was in the ViewPager class where on line 1029 the for loop would never finished:
for (int pos = mCurItem + 1; pos < N; pos++)
//N is the return Integer.MAX_VALUE and the mCurItem is the item set in setCurrentItem() method