I have a viewpager with webviews, and I want to detect if a user have swiped at all.
I mainly want to keep count of how many times they swiped between views.
The problem with keeping up with the position within the viewpager is that it might not be tracking the position of the view you are on, as it is constantly generating the views +1 and -1 away from where you are.
So my next way to get this was with the counting swipes that the user made. Only the kind of horizontal swipe that would change viewpager
I was thinking this would have something to do with gesture listener and some directional logic, but I am unsure.
Also I was wondering if the touch recognition of the viewpager and the webview would make it difficult to catch gestures in another overriden function just for counting.
insight appreciated
ViewPagers allow you to set an onPageChangeListener using setOnPageChangeListener(). OnPageChangeListener has a method, onPageSelected, which will be called each time the user flips the page. You can increment a count inside this method to keep track of page views.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With