title: Android Bottom Sheet after state changed
body: <p>I have a screen with a bottomsheet, but for the transition, and animation to work between activities I need the bottomsheet to be collapsed when the user goes on back pressed. I tried this</p>
  <pre><code>@Override
  public void onBackPressed(){
      if (mBottomSheetBehavior.getState() == BottomSheetBehavior.STATE_COLLAPSED) {
          super.onBackPressed();
      } else {
          mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
          super.onBackPressed();
      }
  
      mShowingBack = false;
  }
  </code></pre>
  <p>However, that doesn't work as the activity goes back while the bottomsheet is only halfway down.</p>