I'm using a FragmentActivity with a FragmentPagerAdapter which holds a number of Fragment objects through which I can slide with a horizontal swipe.
In the FragmentActivity is a TextView which displays the current item in the list (looks something like this: "3 of 25"). When I swipe to the right I want to increase that number by one, when I swipe to the left the number has to go down by one.
As long as I just swipe in one direction it works just fine but as soon as I change the swiping direction some numbers are being skipped. When I start at #15 it goes up to 16, then 17 then 18. If I swipe to the left then the number goes from 18 to 15.
What is the proper way to implement such a counter?