Search code examples
androidandroid-cameraandroid-camera2android-camerax

Analog of setPreviewCallbackWithBuffer in CameraX or android.hardware.camera2


Is there a method similar to setPreviewCallbackWithBuffer in function in CameraX or android.hardware.camera2? This method was deprecated along with android.hardware.camera. Essentially I want to set a callback to the camera feed that presumes getting the image as a buffer. Any suggestions?


Solution

  • Essentially, both camera2 and CameraX work in a manner that is comparable to setPreviewCallbackWithBuffer(). You don't need to use some special methods to avoid memory allocations while capturing preview.