I have a ViewPager which Toolbar tabs.
I have to know how many times user clicked tabs and how many times user swiped and selected a page.
I am using ViewPager.OnPageChangeListener() for this purpose.
viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}
@Override public void onPageSelected(int position) {
// Here i am sending the GA event
}
@Override public void onPageScrollStateChanged(int state) {
}
});
OnPageSelected is called for both click and swipe of page. How will I differentiate the page selected is from click of tabs or its from swipe of Viewpager ?