Today I'm trying to set ViewPager.setOnPageChangeListener
and I've found out that it's deprecated.
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 Here.
this worked for me:
viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener(){ @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { conterchange.setText(""+(1+position)); } @Override public void onPageSelected(int position) { } @Override public void onPageScrollStateChanged(int state) { } });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With