Preview.PreviewSurfaceCallback
public
static
interface
Preview.PreviewSurfaceCallback
androidx.camera.core.Preview.PreviewSurfaceCallback |
A callback to access the Preview Surface.
Summary
Public methods | |
---|---|
abstract
ListenableFuture<Surface>
|
getSurface(Size resolution, int imageFormat)
Get preview output Surface with the given resolution and format. |
Public methods
getSurface
public abstract ListenableFuture<Surface> getSurface (Size resolution, int imageFormat)
Get preview output Surface with the given resolution and format.
This is called when Preview needs a valid Surface. e.g. when the Preview is bound to lifecycle or the current Surface is no longer valid. When that happens, the implementation is required to create a Surface with the given resolution/format.
The Surface should be released after the use case is no longer active. If released prematurely, the implementation will be asked to provide a new Surface via this method.
Parameters | |
---|---|
resolution |
Size : the resolution required by CameraX. |
imageFormat |
int : the ImageFormat required by CameraX. |
Returns | |
---|---|
ListenableFuture<Surface> |
A ListenableFuture that contains the user created Surface. |