I am using ViewPager (support library). I want to know every time the ViewPager change the visible page, it is scrolling left or right.
Please give me a solution. An
You can keep class member variable to save last visited page
private int mLastVisitedPageIndex = 0;
Then use following function to check direction
@Override
public void onPageSelected(int i) {
boolean isMovingForward = mLastVisitedPageIndex < i?true:false;
//Use isMovingForward variable anywhere now
mLastVisitedPageIndex = i;
}