pratiksanglikar
pratiksanglikar

Reputation: 23

Android: Tabs + Swipe : how to know the previous screen from where the page has navigated?

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.

Upvotes: 2

Views: 107

Answers (1)

Manoj Kumar
Manoj Kumar

Reputation: 1520

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

Upvotes: 1

Related Questions