The documentation for the method getItemPosition in Android\'s PagerAdapter class states that it is:
Called when the host view is attempting to determine
You can see in ViewPager.java that getItemPosition
is called only in dataSetChanged
. This means the item's position changed if it's different than the last time dataSetChanged
was called.
I would not worry so much about the meaning of "changed"; there are two cases:
getItemPosition
returns POSITION_UNCHANGED
;POSITION_UNCHANGED
or the actual position. So to keep the implementation simple you can return the position (or POSITION_NONE
) and forget about POSITION_UNCHANGED
..