Jaydipsinh Zala Jaydipsinh Zala - 1 year ago 499
Android Question

viewpager setonpagechangelistener deprecated

Today i'm trying to set

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

please help!

Answer Source

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download