Skip to content Skip to sidebar Skip to footer

Android Carouselpicker When 1st Item Is Click

I found a library on github that has CarouselPicker com.github.Vatican-Cameos:CarouselPicker:v1.0 i added this in the dependencies and compile also in repositories maven { url 'htt

Solution 1:

I found a library you used on this link You must use addOnPageChangeListener like this:

carouselPicker.addOnPageChangeListener(newViewPager.OnPageChangeListener() {
        @OverridepublicvoidonPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

        }

        @OverridepublicvoidonPageSelected(int position) {
            //position of the selected itemif(position == 0){
                startActivity(newIntent(thisActivity.this, anotherActivity1.class));
            }                
            elseif(position == 1){
                startActivity(newIntent(thisActivity.this, anotherActivity2.class));
            } 
            // Same conditions for another cases.
        }

        @OverridepublicvoidonPageScrollStateChanged(int state) {

        }
    });

So, your onClickListener that you want to handle the click event, is onPageSelected method.

Post a Comment for "Android Carouselpicker When 1st Item Is Click"