title: Controlling Sensor ISO and Exposure time in android camera2API
body: <p>I am trying to add in Manual Camera Controls new exposure value and ISO values. I am using the Camera2Basic Example. The problem I face now is that I am new to Android. I tried looking at L-Camera but its in Scala and that confuses me further. </p>
  
  <p>I tried the following changes but there was no update to the preview of the image.</p>
  
  <pre><code> private void createCameraPreviewSession() {
      try {
          SurfaceTexture texture = mTextureView.getSurfaceTexture();
          assert texture != null;
  
          // We configure the size of default buffer to be the size of camera preview we want.
          texture.setDefaultBufferSize(mPreviewSize.getWidth(), mPreviewSize.getHeight());
  
          // This is the output Surface we need to start preview.
          Surface surface = new Surface(texture);
  
          // We set up a CaptureRequest.Builder with the output Surface.
          mPreviewRequestBuilder
                  = mCameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
          mPreviewRequestBuilder.addTarget(surface);
  
          // Here, we create a CameraCaptureSession for camera preview.
          mCameraDevice.createCaptureSession(Arrays.asList(surface, mImageReader.getSurface()),
                  new CameraCaptureSession.StateCallback() {
  
                      @Override
                      public void onConfigured(@NonNull CameraCaptureSession cameraCaptureSession) {
                          // The camera is already closed
                          if (null == mCameraDevice) {
                              return;
                          }
  
                          // When the session is ready, we start displaying the preview.
                          mCaptureSession = cameraCaptureSession;
                          try {
                              // Auto focus should be continuous for camera preview.
                              mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AF_MODE,
                                      CaptureRequest.CONTROL_AF_MODE_CONTINUOUS_PICTURE);
  
                              mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AE_MODE,
                                      CaptureRequest.CONTROL_AE_MODE_OFF);
  
                              mPreviewRequestBuilder.set(CaptureRequest.SENSOR_EXPOSURE_TIME,Long.valueOf("100000"));
                              mPreviewRequestBuilder.set(CaptureRequest.SENSOR_SENSITIVITY,1600);
  
                              // Flash is automatically enabled when necessary.
                              setAutoFlash(mPreviewRequestBuilder);
  
                              // Finally, we start displaying the camera preview.
                              mPreviewRequest = mPreviewRequestBuilder.build();
                              mCaptureSession.setRepeatingRequest(mPreviewRequest,
                                      mCaptureCallback, mBackgroundHandler);
                          } catch (CameraAccessException e) {
                              e.printStackTrace();
                          }
                      }
  
                      @Override
                      public void onConfigureFailed(
                              @NonNull CameraCaptureSession cameraCaptureSession) {
                          showToast("Failed");
                      }
                  }, null
          );
      } catch (CameraAccessException e) {
          e.printStackTrace();
      }
  }
  </code></pre>