Home > Software design >  Android: Tabs Swipe : how to know the previous screen from where the page has navigated?
Android: Tabs Swipe : how to know the previous screen from where the page has navigated?

Time:11-03

I have a project where I've used Tabs Swipe UI. The problem here is I want to know from which tab the tab been navigated from. like, for the tab 2, I can navigate from tab 1 as well as tab 3. So I want to know from which tab I have navigated.

CodePudding user response:

I suggest you to use Velocity tracker to find the velocity of the swipe in X-direction (using .getXVelocity()). If the value is a negative one, then it was from tab 1. Else, it was from tab 3

  • Related