Jaydipsinh Zala Jaydipsinh Zala - 5 months ago 122
Android Question

viewpager setonpagechangelistener deprecated

Today i'm trying to set

ViewPager.setOnPageChangeListener
what i've found that it is deprecated.

please help!

Answer

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() {
        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

        }

        @Override
        public void onPageSelected(int position) {

        }

        @Override
        public void onPageScrollStateChanged(int state) {

        }
    });

You can find this at Google Developer site.