Insert pages in the middle of a FragmentPageAdapter
You forgot about one method.
Override getItemId(int position) from FragmentPagerAdapter
which simply returns position to return something what will identify fragment instance.
public long getItemId(int position) { switch (position) { case 0: return 0xA; case 1: return condition ? 0xC : 0xB; case 2: if (condition) { return 0xB; } default: throw new IllegalStateException("Position out of bounds"); }}