I know that using ViewPager I can get current fragment index but how can I get previous fragment index?
Its not a problem when I go forward (i-1) but how about going backward? Maybe their is a way to detect which direction I swipe? or something else
I know that using ViewPager I can get current fragment index but how can I get previous fragment index?
Its not a problem when I go forward (i-1) but how about going backward? Maybe their is a way to detect which direction I swipe? or something else
I just answered a similar question --> Holding references to the fragments returned by PagerAdapter. In that question the user wants to connect the current fragment to a Server and disconnect the previous one, so only one connection is active at any given time.