Jaydipsinh Zala Jaydipsinh Zala - 1 year ago 525
Android Question

viewpager setonpagechangelistener deprecated

Today i'm trying to set

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() {
        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.

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