Fragmen untuk Typecasting Aktivitas

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

            }
        });
Frantic Flatworm