# CaptureResultWrappers

Artifact: [androidx.camera:camera-common](https://developer.android.com/jetpack/androidx/releases/camera) [View Source](https://cs.android.com/search?q=file:androidx/camera/common/CaptureResultWrapper.kt+class:androidx.camera.common.CaptureResultWrappers) Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

*** ** * ** ***


```
public static class CaptureResultWrappers
```

<br />

*** ** * ** ***

Helper utilities for constructing and wrapping `https://developer.android.com/reference/androidx/camera/common/CaptureResultWrapper` instances.

## Summary

| ### Public fields |
|---|---|
| `static @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/common/CaptureResultWrappers` | `https://developer.android.com/reference/androidx/camera/common/CaptureResultWrappers#INSTANCE()` |

| ### Public methods |
|---|---|
| `static final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/common/CaptureResultWrapper` | `https://developer.android.com/reference/androidx/camera/common/CaptureResultWrappers#wrap(android.hardware.camera2.CaptureResult,androidx.camera.common.CameraId,androidx.camera.common.CaptureRequestWrapper,kotlin.collections.Map)( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/hardware/camera2/CaptureResult.html captureResult, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/common/CameraId cameraId, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/common/CaptureRequestWrapper captureRequest, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/common/Metadata.Key<@https://developer.android.com/reference/androidx/annotation/NonNull ?>, https://developer.android.com/reference/java/lang/Object.html> metadata )` Wraps a native `https://developer.android.com/reference/android/hardware/camera2/CaptureResult.html` into a `https://developer.android.com/reference/androidx/camera/common/CaptureResultWrapper`. |

## Public fields

### INSTANCE

Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

```
public static @NonNull CaptureResultWrappers INSTANCE
```

## Public methods

### wrap

Added in [1.7.0-rc02](https://developer.android.com/jetpack/androidx/releases/camera#1.7.0-rc02)

```
public static final @NonNull CaptureResultWrapper wrap(
    @NonNull CaptureResult captureResult,
    @NonNull CameraId cameraId,
    @NonNull CaptureRequestWrapper captureRequest,
    @NonNull Map<@NonNull Metadata.Key<@NonNull ?>, Object> metadata
)
```

Wraps a native `https://developer.android.com/reference/android/hardware/camera2/CaptureResult.html` into a `https://developer.android.com/reference/androidx/camera/common/CaptureResultWrapper`.

```kotlin
import androidx.camera.common.CameraId
import androidx.camera.common.CaptureRequestWrappers
import androidx.camera.common.CaptureResultWrapper
import androidx.camera.common.CaptureResultWrappers

val cameraId = CameraId("0")
val captureRequest = CaptureRequestWrappers.wrap(captureResult.request)

// Wrap a native CaptureResult into a CaptureResultWrapper.
val resultWrapper: CaptureResultWrapper =
    CaptureResultWrappers.wrap(
        captureResult = captureResult,
        cameraId = cameraId,
        captureRequest = captureRequest,
    )

// Query standard Camera2 result keys:
val lensState = resultWrapper[CaptureResult.LENS_STATE]
val frameNumber = resultWrapper.frameNumber
val originatingRequest = resultWrapper.captureRequest
```

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/hardware/camera2/CaptureResult.html captureResult` | the native `https://developer.android.com/reference/android/hardware/camera2/CaptureResult.html` to wrap. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/common/CameraId cameraId` | the `https://developer.android.com/reference/androidx/camera/common/CameraId` of the camera device that produced the result. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/common/CaptureRequestWrapper captureRequest` | the `https://developer.android.com/reference/androidx/camera/common/CaptureRequestWrapper` representing the request that produced this result. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/common/Metadata.Key<@https://developer.android.com/reference/androidx/annotation/NonNull ?>, https://developer.android.com/reference/java/lang/Object.html> metadata` | optional map of custom `https://developer.android.com/reference/androidx/camera/common/Metadata.Key` values to attach to the wrapper. |

| Returns |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/camera/common/CaptureResultWrapper` | a `https://developer.android.com/reference/androidx/camera/common/CaptureResultWrapper` wrapping the given `https://developer.android.com/reference/androidx/camera/common/CaptureResultWrappers#wrap(android.hardware.camera2.CaptureResult,androidx.camera.common.CameraId,androidx.camera.common.CaptureRequestWrapper,kotlin.collections.Map)` and metadata. |