Udostępnij za pośrednictwem


CameraExtensionSession.Close Method

Definition

Close this capture session asynchronously.

[Android.Runtime.Register("close", "()V", "GetCloseHandler", ApiSince=31)]
public virtual void Close ();
[<Android.Runtime.Register("close", "()V", "GetCloseHandler", ApiSince=31)>]
abstract member Close : unit -> unit
override this.Close : unit -> unit

Implements

Attributes

Remarks

Close this capture session asynchronously.

Closing a session frees up the target output Surfaces of the session for reuse with either a new session, or to other APIs that can draw to Surfaces.

Note that creating a new capture session with android.hardware.camera2.CameraDevice#createCaptureSession or android.hardware.camera2.CameraDevice#createExtensionSession will close any existing capture session automatically, and call the older session listener's StateCallback#onClosed callback. Using android.hardware.camera2.CameraDevice#createCaptureSession or android.hardware.camera2.CameraDevice#createExtensionSession directly without closing is the recommended approach for quickly switching to a new session, since unchanged target outputs can be reused more efficiently.

Once a session is closed, all methods on it will throw an IllegalStateException, and any repeating requests are stopped (as if #stopRepeating() was called).

Closing a session is idempotent; closing more than once has no effect.

Java documentation for android.hardware.camera2.CameraExtensionSession.close().

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