# StillCaptureInterop

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

*** ** * ** ***


```
interface StillCaptureInterop
```

<br />

Known direct subclasses [ImageCaptureCamera2Interop](https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/ImageCaptureCamera2Interop)

|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/ImageCaptureCamera2Interop` | Configures Camera2 options on an `https://developer.android.com/reference/kotlin/androidx/camera/core/ImageCapture` use case. |

*** ** * ** ***

Configures Camera2 options for still capture requests.

Keys configured for still capture requests override corresponding keys set in repeating requests.

## Summary

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/StillCaptureInterop#setStillCaptureCallback(java.util.concurrent.Executor,android.hardware.camera2.CameraCaptureSession.CaptureCallback)( executor: https://developer.android.com/reference/java/util/concurrent/Executor.html, callback: https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.CaptureCallback.html )` Sets the callback to receive still capture updates with an executor. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `<V : https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?> https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/StillCaptureInterop#setStillCaptureRequestOption(android.hardware.camera2.CaptureRequest.Key,kotlin.Any)(key: https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.Key.html<V>, value: V)` Sets a `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.Key.html` and value for still capture requests. |

| ### Public properties |
|---|---|
| `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.CaptureCallback.html?` | `https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/StillCaptureInterop#stillCaptureCallback()` The callback to receive still capture updates on a direct executor. |
| `open https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/StillCaptureRequestOptionTarget` | `https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/StillCaptureInterop#stillCaptureRequest()` Helper target property supporting `stillCaptureRequest[key] = value` indexing operator syntax. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/StillCaptureInterop#stillCaptureRequestTemplateType()` The template type for still capture requests. |

## Public functions

### setStillCaptureCallback

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

```
fun setStillCaptureCallback(
    executor: Executor,
    callback: CameraCaptureSession.CaptureCallback
): Unit
```

Sets the callback to receive still capture updates with an executor.

**Warning:** The `https://developer.android.com/reference/kotlin/androidx/camera/camera2/interop/StillCaptureInterop#setStillCaptureCallback(java.util.concurrent.Executor,android.hardware.camera2.CameraCaptureSession.CaptureCallback)` receives raw `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html` instances. Directly invoking state-altering, lifecycle, or request-submitting methods on these raw objects bypasses CameraX pipeline management and causes state desynchronization, stream freezing, or crashes. Do not invoke:

- Session lifecycle methods: `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#close()`, `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#abortCaptures()`, or `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#stopRepeating()`

- Request submission methods: `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#setRepeatingRequest(android.hardware.camera2.CaptureRequest, android.hardware.camera2.CameraCaptureSession.CaptureCallback, android.os.Handler)`, `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#setRepeatingBurst(java.util.List&lt;android.hardware.camera2.CaptureRequest&gt;, android.hardware.camera2.CameraCaptureSession.CaptureCallback, android.os.Handler)`, `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#capture(android.hardware.camera2.CaptureRequest, android.hardware.camera2.CameraCaptureSession.CaptureCallback, android.os.Handler)`, or `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#captureBurst(java.util.List&lt;android.hardware.camera2.CaptureRequest&gt;, android.hardware.camera2.CameraCaptureSession.CaptureCallback, android.os.Handler)`

- Surface / output configuration methods: `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#updateOutputConfiguration(android.hardware.camera2.params.OutputConfiguration)`, `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#finalizeOutputConfigurations(java.util.List&lt;android.hardware.camera2.params.OutputConfiguration&gt;)`, `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#prepare(android.view.Surface)`, or `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#switchToOffline(java.util.Collection&lt;android.view.Surface&gt;, java.util.concurrent.Executor, android.hardware.camera2.CameraOfflineSession.CameraOfflineSessionCallback)`

| Parameters |
|---|---|
| `executor: https://developer.android.com/reference/java/util/concurrent/Executor.html` | executor to run the callback on |
| `callback: https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.CaptureCallback.html` | still capture callback |

### setStillCaptureRequestOption

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

```
fun <V : Any?> setStillCaptureRequestOption(key: CaptureRequest.Key<V>, value: V): Unit
```

Sets a `https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.Key.html` and value for still capture requests.

The capture request keys for one-shot still captures (such as `https://developer.android.com/reference/kotlin/androidx/camera/core/ImageCapture#takePicture(java.util.concurrent.Executor,androidx.camera.core.ImageCapture.OnImageCapturedCallback)`) are determined by copying all repeating request keys (which may include keys added via `https://developer.android.com/reference/kotlin/androidx/camera/core/SessionConfig.Builder#setInterop(androidx.camera.core.InteropConfigurator)` or `https://developer.android.com/reference/kotlin/androidx/camera/core/CameraControl#applyInteropAsync(androidx.camera.core.InteropConfigurator<? super androidx.camera.core.CameraControl>)`) and then overriding them with the still capture request key set here.

| Parameters |
|---|---|
| `key: https://developer.android.com/reference/android/hardware/camera2/CaptureRequest.Key.html<V>` | capture request option key |
| `value: V` | option value |

## Public properties

### stillCaptureCallback

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

```
var stillCaptureCallback: CameraCaptureSession.CaptureCallback?
```

The callback to receive still capture updates on a direct executor.

**Warning:** The callback receives raw `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html` instances. Directly invoking state-altering, lifecycle, or request-submitting methods on these raw objects bypasses CameraX pipeline management and causes state desynchronization, stream freezing, or crashes. Do not invoke:

- Session lifecycle methods: `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#close()`, `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#abortCaptures()`, or `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#stopRepeating()`

- Request submission methods: `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#setRepeatingRequest(android.hardware.camera2.CaptureRequest, android.hardware.camera2.CameraCaptureSession.CaptureCallback, android.os.Handler)`, `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#setRepeatingBurst(java.util.List&lt;android.hardware.camera2.CaptureRequest&gt;, android.hardware.camera2.CameraCaptureSession.CaptureCallback, android.os.Handler)`, `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#capture(android.hardware.camera2.CaptureRequest, android.hardware.camera2.CameraCaptureSession.CaptureCallback, android.os.Handler)`, or `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#captureBurst(java.util.List&lt;android.hardware.camera2.CaptureRequest&gt;, android.hardware.camera2.CameraCaptureSession.CaptureCallback, android.os.Handler)`

- Surface / output configuration methods: `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#updateOutputConfiguration(android.hardware.camera2.params.OutputConfiguration)`, `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#finalizeOutputConfigurations(java.util.List&lt;android.hardware.camera2.params.OutputConfiguration&gt;)`, `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#prepare(android.view.Surface)`, or `https://developer.android.com/reference/android/hardware/camera2/CameraCaptureSession.html#switchToOffline(java.util.Collection&lt;android.view.Surface&gt;, java.util.concurrent.Executor, android.hardware.camera2.CameraOfflineSession.CameraOfflineSessionCallback)`

### stillCaptureRequest

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

```
open val stillCaptureRequest: StillCaptureRequestOptionTarget
```

Helper target property supporting `stillCaptureRequest[key] = value` indexing operator syntax.

### stillCaptureRequestTemplateType

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

```
var stillCaptureRequestTemplateType: Int
```

The template type for still capture requests.