title: BottomSheetBehavior Illegal state argument: 5
body: <p>Could someone explain about when this exception occurs?</p>
  
  <pre><code>12-18 11:20:07.225 15944-15944/com.test.dev.debug E/AndroidRuntime: FATAL EXCEPTION: main
  Process: com.dev.debug, PID: 15944
  java.lang.IllegalArgumentException: Illegal state argument: 5
      at android.support.design.widget.BottomSheetBehavior.startSettlingAnimation(BottomSheetBehavior.java:631)
      at android.support.design.widget.BottomSheetBehavior$1.run(BottomSheetBehavior.java:550)
      at android.os.Handler.handleCallback(Handler.java:751)
      at android.os.Handler.dispatchMessage(Handler.java:95)
      at android.os.Looper.loop(Looper.java:154)
      at android.app.ActivityThread.main(ActivityThread.java:6123)
      at java.lang.reflect.Method.invoke(Native Method)
      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:757)
  </code></pre>
  
  <p>Java class</p>
  
  <pre><code>public class BottomSheetController {
  
      private BottomSheetBehavior&lt;View&gt; bottomSheetBehavior;
      private WeakReference&lt;FrameLayout&gt; bottomSheetContainer;
      private Slide slide;
  
      public interface Slide {
          void onSlide(@NonNull View bottomSheet, float slideOffset);
      }
  
      public void bind(FrameLayout bottomSheetContainer) {
          this.bottomSheetContainer = new WeakReference&lt;&gt;(bottomSheetContainer);
          bottomSheetBehavior = BottomSheetBehavior.from(this.bottomSheetContainer.get());
          bottomSheetBehavior.setHideable(true);
          bottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
          bottomSheetBehavior.setBottomSheetCallback(sheetCallback());
      }
  
      public void unbind() {
          this.bottomSheetContainer.clear();
      }
  
      public void setSlide(Slide slide) {
          this.slide = slide;
      }
  
      public void collapse() {
          bottomSheetBehavior.setHideable(true);
          bottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
      }
  
      public void expand() {
          bottomSheetBehavior.setHideable(false);
          bottomSheetBehavior.setState(BottomSheetBehavior.STATE_EXPANDED);
      }
  
      public void hide() {
          bottomSheetBehavior.setHideable(true);
          bottomSheetBehavior.setState(BottomSheetBehavior.STATE_HIDDEN);
      }
  
      public int getState() {
          return bottomSheetBehavior.getState();
      }
  
      private BottomSheetBehavior.BottomSheetCallback sheetCallback() {
          return new BottomSheetBehavior.BottomSheetCallback() {
              @Override
              public void onStateChanged(@NonNull View bottomSheet, int newState) {
  
                  if (newState != BottomSheetBehavior.STATE_HIDDEN) {
                      bottomSheetBehavior.setHideable(false);
                  } else {
                      bottomSheetBehavior.setHideable(true);
                  }
              }
  
              @Override
              public void onSlide(@NonNull View bottomSheet, float slideOffset) {
  
                  if (slide != null) {
                      slide.onSlide(bottomSheet, slideOffset);
                  }
              }
          };
      }
  }
  </code></pre>