Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

fragment to activity typecasting

   viewPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
            @Override
            public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {

            }

            @Override
            public void onPageSelected(int position) {
                if (position == 0) {
                    openBottomSheetForScanning();
                } else if (position == 1) {
                    ((ReturnCrateFragment) adapter.getItem(position)).openBottomSheetForScanning();
                }
            }

            @Override
            public void onPageScrollStateChanged(int state) {

            }
        });
 
PREVIOUS NEXT
Tagged: #fragment #activity #typecasting
ADD COMMENT
Topic
Name
8+8 =