Jaydipsinh Zala Jaydipsinh Zala - 4 months ago 44x
Android Question

viewpager setonpagechangelistener deprecated

Today i'm trying to set

what i've found that it is deprecated.

please help!


Found answer on my own just wanted to share it.i.e,

ViewPager.setOnPageChangeListener is deprecated now. Need to use ViewPager.addOnPageChangeListener instead.

for example,

ViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {


        public void onPageSelected(int position) {


        public void onPageScrollStateChanged(int state) {


You can find this at Google Developer site.