public override void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) { // "onSurfaceTextureAvailable" is called, which means that CameraCaptureSession is not created. // We need to configure transform for TextureView and crate CameraCaptureSession. outerInstance.configureTransform(width, height); outerInstance.createPreviewSession(); }