Partager via


CameraCaptureSession.Capture Method

Definition

Submit a request for an image to be captured by the camera device.

[Android.Runtime.Register("capture", "(Landroid/hardware/camera2/CaptureRequest;Landroid/hardware/camera2/CameraCaptureSession$CaptureCallback;Landroid/os/Handler;)I", "GetCapture_Landroid_hardware_camera2_CaptureRequest_Landroid_hardware_camera2_CameraCaptureSession_CaptureCallback_Landroid_os_Handler_Handler")]
public abstract int Capture (Android.Hardware.Camera2.CaptureRequest request, Android.Hardware.Camera2.CameraCaptureSession.CaptureCallback? listener, Android.OS.Handler? handler);
[<Android.Runtime.Register("capture", "(Landroid/hardware/camera2/CaptureRequest;Landroid/hardware/camera2/CameraCaptureSession$CaptureCallback;Landroid/os/Handler;)I", "GetCapture_Landroid_hardware_camera2_CaptureRequest_Landroid_hardware_camera2_CameraCaptureSession_CaptureCallback_Landroid_os_Handler_Handler")>]
abstract member Capture : Android.Hardware.Camera2.CaptureRequest * Android.Hardware.Camera2.CameraCaptureSession.CaptureCallback * Android.OS.Handler -> int

Parameters

request
CaptureRequest

the settings for this capture

listener
CameraCaptureSession.CaptureCallback

The callback object to notify once this request has been processed. If null, no metadata will be produced for this capture, although image data will still be produced.

handler
Handler

the handler on which the listener should be invoked, or null to use the current thread's android.os.Looper looper.

Returns

int A unique capture sequence ID used by CaptureCallback#onCaptureSequenceCompleted.

Attributes

Exceptions

if the camera device is no longer connected or has encountered a fatal error

if this session is no longer active, either because the session was explicitly closed, a new session has been created or the camera device has been closed.

if the request targets no Surfaces or Surfaces that are not configured as outputs for this session; or the request targets a set of Surfaces that cannot be submitted simultaneously in a reprocessable capture session; or a reprocess capture request is submitted in a non-reprocessable capture session; or the reprocess capture request was created with a TotalCaptureResult from a different session; or the capture targets a Surface in the middle of being Prepare(Surface); or the handler is null, the listener is not null, and the calling thread has no looper.

Remarks

Java documentation for android.hardware.camera2.CameraCaptureSession.capture(android.hardware.camera2.CaptureRequest, android.hardware.camera2.CaptureCallback, android.os.Handler).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

See also

  • <xref:Android.Hardware.Camera2.CameraCaptureSession.SetRepeatingRequest(Android.Hardware.Camera2.CaptureRequest%2c+.CaptureCallback%2c+.CaptureCallback)>
  • AbortCaptures()