In my Android application, I am using a viewpager for image swiping. My requirement is, if a user swipes out of the first and last page, the activity should finish.
I ha
I have also used the code from this SO answer. Make sure you make the necessary changes to your activity class. Here's what I did...
I changed my activity so it implements CustomViewPager.OnSwipeOutListener
.
In my activity, after my mPager = (CustomViewPager) findViewById(R.id.pager);
line, I call
mPager.setOnSwipeOutListener(this);
All you need to do then is override the onSwipeOutAtStart()
and onSwipeOutAtEnd()
methods in your activity.