I am unable to understand properly what these functions are used for in my FragmentActivity
class.
viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageSelected(int pos) {
// on changing the page
// make respected tab selected
position = pos;
actionBar.setSelectedNavigationItem(pos);
new Getquestions().execute();
}
@Override
public void onPageScrolled(int arg0, float arg1, int arg2) {
}
@Override
public void onPageScrollStateChanged(int arg0) {
}
});
}
@Override
public void onTabReselected(Tab tab, FragmentTransaction ft) {
}
@Override
public void onTabSelected(Tab tab, FragmentTransaction ft) {
// on tab selected
// show respected fragment view
viewPager.setCurrentItem(tab.getPosition());
}
@Override
public void onTabUnselected(Tab tab, FragmentTransaction ft) {
}
I am using a view pager for page sliding, and what I want to do is, if a condition is false, for example I have three edit texts
in fragment one
, and if a user wants to slide to fragment two
without filling up the texts then the must not slide.
I tried to find any such example but I am unable to find it. Can anyone help? Understanding these functions will help me implement my thing I guess