SurfaceRequest

public final class SurfaceRequest
extends Object

java.lang.Object
   ↳ androidx.camera.core.SurfaceRequest


A completable, single-use request of a Surface.

Contains requirements for surface characteristics along with methods for completing the request and listening for request cancellation.

Summary

Nested classes

class SurfaceRequest.Result

Result of providing a surface to a SurfaceRequest via SurfaceRequest.provideSurface(Surface, Executor, Consumer)

class SurfaceRequest.TransformationInfo

Transformation associated the preview output. 

interface SurfaceRequest.TransformationInfoListener

Listener that receives updates of the SurfaceRequest.TransformationInfo associated with the SurfaceRequest

Public methods

void addRequestCancellationListener(Executor executor, Runnable listener)

Adds a listener to be informed when the camera cancels the surface request.

void clearTransformationInfoListener()

Clears the SurfaceRequest.TransformationInfoListener set via setTransformationInfoListener(Executor, SurfaceRequest.TransformationInfoListener).

Size getResolution()

Returns the resolution of the requested Surface.

void provideSurface(Surface surface, Executor executor, Consumer<SurfaceRequest.Result> resultListener)

Completes the request for a Surface if it has not already been completed or cancelled.

void setTransformationInfoListener(Executor executor, SurfaceRequest.TransformationInfoListener listener)

Sets a listener to receive updates on transformation info.

boolean willNotProvideSurface()

Signals that the request will never be fulfilled.

Inherited methods