title: Is bindToLifecycle() is necessary to switch ON/OFF/AUTO flash every time after creating preview in CameraX library
body: <p>As I understand from many implementations such as :</p>
  
  <p><a href="https://github.com/android/camera-samples/tree/master/CameraXBasic" rel="nofollow noreferrer">https://github.com/android/camera-samples/tree/master/CameraXBasic</a></p>
  
  <p><a href="https://proandroiddev.com/android-camerax-preview-analyze-capture-1b3f403a9395" rel="nofollow noreferrer">https://proandroiddev.com/android-camerax-preview-analyze-capture-1b3f403a9395</a></p>
  
  <p>After every use case in CameraX implementation <strong>cameraProvide.bindToLifecycle()</strong> method needs to be called.</p>
  
  <p>For example, if I need to switch <em>ON</em> the FLASH_MODE of the camera from the default <em>OFF</em> mode, then again bindToLifecycle() method needs to be called.</p>
  
  <p>The disadvantage with this approach is that for a second or two the preview is removed and re-attached which doesn't feel like a smooth transition for an app.</p>
  
  <p><strong>Is there any better practice available or it is the limitation?</strong></p>
  
  <p>I Have attached a sample code below:</p>
  
  <pre><code>   private void bindCameraUseCase() {
      int screenAspectRatio = getAspectRatio(previewView.getWidth(), previewView.getHeight());
      int rotation = previewView.getDisplay().getRotation();
      preview = new Preview.Builder()
              .setTargetAspectRatio(screenAspectRatio)
              .setTargetRotation(rotation)
              .build();
      cameraSelector = new CameraSelector.Builder()
              .requireLensFacing(lensFacing)
              .build();
      imageCapture = new ImageCapture.Builder()
              .setCaptureMode(ImageCapture.CAPTURE_MODE_MINIMIZE_LATENCY)
              .setTargetAspectRatio(screenAspectRatio)
              .setTargetRotation(rotation)
              .setFlashMode(flashMode)
              .build();
      // Must unbind the use-cases before rebinding them
      cameraProvider.unbindAll();
      preview.setSurfaceProvider(previewView.createSurfaceProvider());
      camera = cameraProvider.bindToLifecycle(this, cameraSelector, preview, imageCapture);
  }
  </code></pre>
  
  <p>And to toggle flashlight:</p>
  
  <pre><code>    private void toggleFlash(){
      Log.d(TAG, "toggleFlash: "+flashMode);
      switch (flashMode){
          case ImageCapture.FLASH_MODE_OFF:
              flashMode = ImageCapture.FLASH_MODE_ON;
              flashButton.setBackgroundResource(R.drawable.ic_flash_on_24dp);
              break;
          case ImageCapture.FLASH_MODE_ON:
              flashMode = ImageCapture.FLASH_MODE_AUTO;
              break;
          case ImageCapture.FLASH_MODE_AUTO:
              flashMode = ImageCapture.FLASH_MODE_OFF;
              break;
      }
      bindCameraUseCase();
  }
  </code></pre>
  
  <p><strong>I'm using CameraX version - 1.0.0-beta04</strong></p>