gowong / material-sheet-fab

Android library that provides the floating action button to sheet transition from Google's Material Design.
MIT License
1.58k stars 255 forks source link

java.lang.NullPointerException: isSheetVisible() #37

Closed ghost closed 7 years ago

ghost commented 7 years ago

java.lang.NullPointerException: Attempt to invoke virtual method 'boolean com.gordonwong.materialsheetfab.MaterialSheetFab.isSheetVisible()' on a null object reference

    @Override
    public void onBackPressed() {
        if (materialSheetFab.isSheetVisible()) {
            materialSheetFab.hideSheet();
        } else {
            super.onBackPressed();
        }
    }

Sorry, I found a problem. 😄

gowong commented 7 years ago

Did you initialize materialSheetFab? The error is saying that it's null when you press the back button.