Compartir a través de


ImageReader.AcquireNextImage Method

Definition

Acquire the next Image from the ImageReader's queue.

[Android.Runtime.Register("acquireNextImage", "()Landroid/media/Image;", "GetAcquireNextImageHandler")]
public virtual Android.Media.Image? AcquireNextImage ();
[<Android.Runtime.Register("acquireNextImage", "()Landroid/media/Image;", "GetAcquireNextImageHandler")>]
abstract member AcquireNextImage : unit -> Android.Media.Image
override this.AcquireNextImage : unit -> Android.Media.Image

Returns

a new frame of image data, or null if no image data is available.

Attributes

Exceptions

if maxImages images are currently acquired

Remarks

Acquire the next Image from the ImageReader's queue. Returns null if no new image is available.

Warning: Consider using #acquireLatestImage() instead, as it will automatically release older images, and allow slower-running processing routines to catch up to the newest frame. Usage of #acquireNextImage is recommended for batch/background processing. Incorrectly using this function can cause images to appear with an ever-increasing delay, followed by a complete stall where no new images seem to appear.

This operation will fail by throwing an IllegalStateException if maxImages have been acquired with #acquireNextImage or #acquireLatestImage. In particular a sequence of #acquireNextImage or #acquireLatestImage calls greater than #getMaxImages maxImages without calling Image#close in-between will exhaust the underlying queue. At such a time, IllegalStateException will be thrown until more images are released with Image#close.

Java documentation for android.media.ImageReader.acquireNextImage().

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