3
votes

I have a View pager with list of Fragments on its adapter. This is the scenario that I want to achieve:

Suppose we have 4 Fragments: Fragment1 Fragment2 Fragment3 Fragment4

When I am in Fragment4 swiping back must lead me to Fragment2. This would be the workflow:

Fragment1 -> Fragment2 -> Fragment3 -> Fragment4

Fragment1 <- Fragment2 <- Fragment4

I want to skip fragment3 when swiping from Fragment4.

Any help is highly appreciated. Thank you so much

1

1 Answers

0
votes

Have a look at this project Android-WizardPager by Roman Nurik. He is using method recalculateCutOffPage in MainActivity to block pages in ViewPager and add/remove them dynamically. I think you can use it as a base and extend it functionality to be also "swipe-back" compatible with your "dynamic" ViewPager.