Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Raw use of parameterized class on Android Studio

I have this code on my Android project:

final BottomSheetBehavior infoBottomSheetBehavior = BottomSheetBehavior.from(findViewById(R.id.info_view));
        infoBottomSheetBehavior.addBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() {
            @Override
            public void onStateChanged(@NonNull View bottomSheet, int newState) {
                if (newState == BottomSheetBehavior.STATE_DRAGGING) {
                    infoBottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
                }
            }
            @Override
            public void onSlide(@NonNull View bottomSheet, float slideOffset) {
            }
        });

And the next warning appears over BottomSheetBehavior: Raw use of parameterized class 'BottomSheetBehavior'

Does anybody know how to avoid this warning?

like image 828
Tsilaicos Avatar asked Dec 04 '22 17:12

Tsilaicos


1 Answers

Ok, here is the so basic answer from a coffee talk...

final BottomSheetBehavior<View> infoBottomSheetBehavior = BottomSheetBehavior.from(findViewById(R.id.info_view));
        infoBottomSheetBehavior.addBottomSheetCallback(new BottomSheetBehavior.BottomSheetCallback() {
            @Override
            public void onStateChanged(@NonNull View bottomSheet, int newState) {
                if (newState == BottomSheetBehavior.STATE_DRAGGING) {
                    infoBottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
                }
            }
            @Override
            public void onSlide(@NonNull View bottomSheet, float slideOffset) {
            }
        });

I've just missed the <View>

like image 178
Tsilaicos Avatar answered Jan 11 '23 11:01

Tsilaicos