Android ViewPager when swiping on last screen
You should include an fake blank page to your ViewPager
, when user swipes your actual last page, it comes to this fake one. When this fake one is visible finish the Activity
.
You should try this way, if it does not work, I can give you an example code.
Here is working solution!!
Required variables
....
private boolean isLastPageSwiped;
private int counterPageScroll;
....
Inside onPageScrolled of ViewPager
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
//Here 6 is last position
if (position == 6 && positionOffset == 0 && !isLastPageSwiped){
if(counterPageScroll != 0){
isLastPageSwiped=true;
//Next Activity here
}
counterPageScroll++;
}else{
counterPageScroll=0;
}
}