preview = new Preview(config); preview.setOnPreviewOutputUpdateListener( new Preview.OnPreviewOutputUpdateListener() { @Override public void onUpdated(Preview.PreviewOutput previewOutput) { // Your code here. For example, use previewOutput.getSurfaceTexture() // and post to a GL renderer. }); }); CameraX.bindToLifecycle((LifecycleOwner) this, preview);
Create a Extender object which can be used to apply extension // configurations. BokehImageCaptureExtender bokehImageCapture = new BokehImageCaptureExtender(builder); // Query if extension is available (optional). if (bokehImageCapture.isExtensionAvailable()) { // Enable the extension if available. bokehImageCapture.enableExtension(); } // Finish constructing configuration with the same flow as when not using // extensions. ImageCaptureConfig config = builder.build(); ImageCapture useCase = new ImageCapture(config); CameraX.bindToLifecycle((LifecycleOwner)this, useCase); Bokeh Extender