# LifecycleCameraController

Artifact: [androidx.camera:camera-view](https://developer.android.com/jetpack/androidx/releases/camera) [View Source](https://cs.android.com/search?q=file:androidx/camera/view/LifecycleCameraController.java+class:androidx.camera.view.LifecycleCameraController) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/camera#1.1.0)

*** ** * ** ***

<br />

```
public final class LifecycleCameraController extends CameraController
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [androidx.camera.view.CameraController](https://developer.android.com/reference/androidx/camera/view/CameraController) ||
|   | ↳ | [androidx.camera.view.LifecycleCameraController](https://developer.android.com/reference/androidx/camera/view/LifecycleCameraController) |

*** ** * ** ***

A controller that provides most of the CameraX features.

This a high level controller that provides most of the CameraX core features in a single class. It handles camera initialization, creates and configures `https://developer.android.com/reference/androidx/camera/core/UseCase`s, and bind them to a `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner` when ready. It also listens to device motion sensor and set the target rotation for the use cases.

Code sample:

```
    // Setup.
    CameraController controller = new LifecycleCameraController(context);
    controller.bindToLifecycle(lifecycleOwner);
    PreviewView previewView = findViewById(R.id.preview_view);
    previewView.setController(controller);

    // Use case features
    controller.takePicture(...);

    // Camera control features
    controller.setZoomRatio(.5F);
```

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/camera/view/LifecycleCameraController#LifecycleCameraController(android.content.Context)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context)` |

| ### Public methods |
|---|---|
| `void` | `@https://developer.android.com/reference/androidx/annotation/MainThread https://developer.android.com/reference/androidx/camera/view/LifecycleCameraController#bindToLifecycle(androidx.lifecycle.LifecycleOwner)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner lifecycleOwner)` Sets the `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner` to be bound with the controller. |
| `void` | `@https://developer.android.com/reference/androidx/annotation/MainThread https://developer.android.com/reference/androidx/camera/view/LifecycleCameraController#unbind()()` Clears the previously set `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner` and stops the camera. |

### Inherited Constants

From [androidx.camera.view.CameraController](https://developer.android.com/reference/androidx/camera/view/CameraController) `static final int` `https://developer.android.com/reference/androidx/camera/view/CameraController#COORDINATE_SYSTEM_VIEW_REFERENCED() = 1`

**This field is deprecated.**

Use `https://developer.android.com/reference/androidx/camera/core/ImageAnalysis#COORDINATE_SYSTEM_VIEW_REFERENCED()` instead.

<br />

`static final int` `https://developer.android.com/reference/androidx/camera/view/CameraController#IMAGE_ANALYSIS() = 2`

Bitmask option to enable `https://developer.android.com/reference/androidx/camera/core/ImageAnalysis`.
`static final int` `https://developer.android.com/reference/androidx/camera/view/CameraController#IMAGE_CAPTURE() = 1`

Bitmask option to enable `https://developer.android.com/reference/androidx/camera/core/ImageCapture`.
`static final int` `https://developer.android.com/reference/androidx/camera/view/CameraController#TAP_TO_FOCUS_FAILED() = 4`

The previous tap-to-focus action was failed to complete.
`static final int` `https://developer.android.com/reference/androidx/camera/view/CameraController#TAP_TO_FOCUS_FOCUSED() = 2`

The previous tap-to-focus action was completed successfully and the camera is focused.
`static final int` `https://developer.android.com/reference/androidx/camera/view/CameraController#TAP_TO_FOCUS_NOT_FOCUSED() = 3`

The previous tap-to-focus action was completed successfully but the camera is still unfocused, similar to the `https://developer.android.com/reference/android/hardware/camera2/CameraMetadata.html#CONTROL_AF_STATE_NOT_FOCUSED_LOCKED` state.
`static final int` `https://developer.android.com/reference/androidx/camera/view/CameraController#TAP_TO_FOCUS_NOT_STARTED() = 0`

No tap-to-focus action has been started by the end user.
`static final int` `https://developer.android.com/reference/androidx/camera/view/CameraController#TAP_TO_FOCUS_STARTED() = 1`

A tap-to-focus action has started but not completed.
`static final int` `https://developer.android.com/reference/androidx/camera/view/CameraController#VIDEO_CAPTURE() = 4`

Bitmask option to enable video capture use case.

### Inherited methods

From [androidx.camera.view.CameraController](https://developer.android.com/reference/androidx/camera/view/CameraController) `void` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#clearEffects()()`

Removes all effects.
`void` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#clearImageAnalysisAnalyzer()()`

Removes a previously set analyzer.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<https://developer.android.com/reference/java/lang/Void.html>` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#enableTorch(boolean)(boolean torchEnabled)`

Enable the torch or disable the torch.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/camera/core/CameraControl` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#getCameraControl()()`

Gets the `https://developer.android.com/reference/androidx/camera/core/CameraControl` of the currently attached camera.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/camera/core/CameraInfo` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#getCameraInfo()()`

Gets the `https://developer.android.com/reference/androidx/camera/core/CameraInfo` of the currently attached camera.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/core/CameraSelector` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#getCameraSelector()()`

Gets the `https://developer.android.com/reference/androidx/camera/core/CameraSelector`.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/util/concurrent/Executor.html` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#getImageAnalysisBackgroundExecutor()()`

Gets the default executor for `https://developer.android.com/reference/androidx/camera/core/ImageAnalysis` background tasks.
`int` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#getImageAnalysisBackpressureStrategy()()`

Returns the mode with which images are acquired.
`int` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#getImageAnalysisImageQueueDepth()()`

Gets the image queue depth of `https://developer.android.com/reference/androidx/camera/core/ImageAnalysis`.
`int` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#getImageAnalysisOutputImageFormat()()`

Gets the output image format for `https://developer.android.com/reference/androidx/camera/core/ImageAnalysis`.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/camera/core/resolutionselector/ResolutionSelector` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#getImageAnalysisResolutionSelector()()`

Returns the `https://developer.android.com/reference/androidx/camera/core/resolutionselector/ResolutionSelector` for `https://developer.android.com/reference/androidx/camera/core/ImageAnalysis`.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/camera/view/CameraController.OutputSize` `@https://developer.android.com/reference/androidx/annotation/MainThread
[getImageAnalysisTargetSize](https://developer.android.com/reference/androidx/camera/view/CameraController#getImageAnalysisTargetSize())()`

**This method is deprecated.**

Use `https://developer.android.com/reference/androidx/camera/view/CameraController#getImageAnalysisResolutionSelector()` instead.

<br />

`int` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#getImageCaptureFlashMode()()`

Gets the flash mode for `https://developer.android.com/reference/androidx/camera/core/ImageCapture`.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/util/concurrent/Executor.html` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#getImageCaptureIoExecutor()()`

Gets the default executor for `https://developer.android.com/reference/androidx/camera/core/ImageCapture` IO tasks.
`int` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#getImageCaptureMode()()`

Returns the image capture mode.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/camera/core/resolutionselector/ResolutionSelector` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#getImageCaptureResolutionSelector()()`

Returns the `https://developer.android.com/reference/androidx/camera/core/resolutionselector/ResolutionSelector` for `https://developer.android.com/reference/androidx/camera/core/ImageCapture`.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/camera/view/CameraController.OutputSize` `@https://developer.android.com/reference/androidx/annotation/MainThread
[getImageCaptureTargetSize](https://developer.android.com/reference/androidx/camera/view/CameraController#getImageCaptureTargetSize())()`

**This method is deprecated.**

Use `https://developer.android.com/reference/androidx/camera/view/CameraController#getImageCaptureResolutionSelector()` instead.

<br />

`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<https://developer.android.com/reference/java/lang/Void.html>` `https://developer.android.com/reference/androidx/camera/view/CameraController#getInitializationFuture()()`

Gets a `https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html` that completes when camera initialization completes.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/camera/core/resolutionselector/ResolutionSelector` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#getPreviewResolutionSelector()()`

Returns the `https://developer.android.com/reference/androidx/camera/core/resolutionselector/ResolutionSelector` for `https://developer.android.com/reference/androidx/camera/core/Preview`.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/camera/view/CameraController.OutputSize` `@https://developer.android.com/reference/androidx/annotation/MainThread
[getPreviewTargetSize](https://developer.android.com/reference/androidx/camera/view/CameraController#getPreviewTargetSize())()`

**This method is deprecated.**

Use `https://developer.android.com/reference/androidx/camera/view/CameraController#getPreviewResolutionSelector()` instead.

<br />

`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/lifecycle/LiveData<https://developer.android.com/reference/androidx/camera/view/TapToFocusInfo>` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#getTapToFocusInfoState()()`

Returns a `https://developer.android.com/reference/androidx/lifecycle/LiveData` with a `https://developer.android.com/reference/androidx/camera/view/TapToFocusInfo` containing the latest focus state and corresponding tap position.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/lifecycle/LiveData<https://developer.android.com/reference/java/lang/Integer.html>` `@https://developer.android.com/reference/androidx/annotation/MainThread
[getTapToFocusState](https://developer.android.com/reference/androidx/camera/view/CameraController#getTapToFocusState())()`

**This method is deprecated.**

Use `https://developer.android.com/reference/androidx/camera/view/CameraController#getTapToFocusInfoState()` instead.

<br />

`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/lifecycle/LiveData<https://developer.android.com/reference/java/lang/Integer.html>` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#getTorchState()()`

Returns a `https://developer.android.com/reference/androidx/lifecycle/LiveData` of current `https://developer.android.com/reference/androidx/camera/core/TorchState`.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/core/DynamicRange` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#getVideoCaptureDynamicRange()()`

Gets the `https://developer.android.com/reference/androidx/camera/core/DynamicRange` for video capture.
`int` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#getVideoCaptureMirrorMode()()`

Gets the mirror mode for video capture.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/video/QualitySelector` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#getVideoCaptureQualitySelector()()`

Returns the `https://developer.android.com/reference/androidx/camera/video/QualitySelector` for `https://developer.android.com/reference/androidx/camera/view/CameraController#VIDEO_CAPTURE()`.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/util/Range.html<https://developer.android.com/reference/java/lang/Integer.html>` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#getVideoCaptureTargetFrameRate()()`

Gets the target frame rate in frames per second for video capture.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/lifecycle/LiveData<https://developer.android.com/reference/androidx/camera/core/ZoomState>` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#getZoomState()()`

Returns a `https://developer.android.com/reference/androidx/lifecycle/LiveData` of `https://developer.android.com/reference/androidx/camera/core/ZoomState`.
`boolean` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#hasCamera(androidx.camera.core.CameraSelector)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/core/CameraSelector cameraSelector)`

Checks if the given `https://developer.android.com/reference/androidx/camera/core/CameraSelector` can be resolved to a camera.
`boolean` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#isAutoRotationEnabled()()`

Returns whether auto-rotation is enabled.
`boolean` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#isImageAnalysisEnabled()()`

Checks if `https://developer.android.com/reference/androidx/camera/core/ImageAnalysis` is enabled.
`boolean` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#isImageCaptureEnabled()()`

Checks if `https://developer.android.com/reference/androidx/camera/core/ImageCapture` is enabled.
`boolean` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#isPinchToZoomEnabled()()`

Returns whether pinch-to-zoom is enabled.
`boolean` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#isRecording()()`

Returns whether there is an in-progress video recording.
`boolean` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#isTapToFocusEnabled()()`

Returns whether tap-to-focus is enabled.
`boolean` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#isVideoCaptureEnabled()()`

Checks if video capture is enabled.
`void` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#setAutoRotationEnabled(boolean)(boolean enabled)`

Sets whether to enable auto-rotation.
`void` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#setCameraSelector(androidx.camera.core.CameraSelector)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/core/CameraSelector cameraSelector)`

Sets the `https://developer.android.com/reference/androidx/camera/core/CameraSelector`.
`void` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#setEffects(java.util.Set<androidx.camera.core.CameraEffect>)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/Set.html<https://developer.android.com/reference/androidx/camera/core/CameraEffect> effects)`

Sets `https://developer.android.com/reference/androidx/camera/core/CameraEffect`.
`void` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#setEnabledUseCases(int)(int enabledUseCases)`

Enables or disables use cases.
`void` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#setImageAnalysisAnalyzer(java.util.concurrent.Executor,androidx.camera.core.ImageAnalysis.Analyzer)(

@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/concurrent/Executor.html executor,

@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/core/ImageAnalysis.Analyzer analyzer

)`

Sets an analyzer to receive and analyze images.
`void` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#setImageAnalysisBackgroundExecutor(java.util.concurrent.Executor)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/util/concurrent/Executor.html executor)`

Sets the executor that will be used for `https://developer.android.com/reference/androidx/camera/core/ImageAnalysis` background tasks.
`void` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#setImageAnalysisBackpressureStrategy(int)(int strategy)`

Sets the backpressure strategy to apply to the image producer to deal with scenarios where images may be produced faster than they can be analyzed.
`void` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#setImageAnalysisImageQueueDepth(int)(int depth)`

Sets the image queue depth of `https://developer.android.com/reference/androidx/camera/core/ImageAnalysis`.
`void` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#setImageAnalysisOutputImageFormat(int)(int imageAnalysisOutputImageFormat)`

Sets the output image format for `https://developer.android.com/reference/androidx/camera/core/ImageAnalysis`.
`void` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#setImageAnalysisResolutionSelector(androidx.camera.core.resolutionselector.ResolutionSelector)(

@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/camera/core/resolutionselector/ResolutionSelector resolutionSelector

)`

Sets the `https://developer.android.com/reference/androidx/camera/core/resolutionselector/ResolutionSelector` for `https://developer.android.com/reference/androidx/camera/core/ImageAnalysis`.
`void` `@https://developer.android.com/reference/androidx/annotation/MainThread
[setImageAnalysisTargetSize](https://developer.android.com/reference/androidx/camera/view/CameraController#setImageAnalysisTargetSize(androidx.camera.view.CameraController.OutputSize))(

@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/camera/view/CameraController.OutputSize targetSize

)`

**This method is deprecated.**

Use `https://developer.android.com/reference/androidx/camera/view/CameraController#setImageAnalysisResolutionSelector(androidx.camera.core.resolutionselector.ResolutionSelector)` instead.

<br />

`void` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#setImageCaptureFlashMode(int)(int flashMode)`

Sets the flash mode for `https://developer.android.com/reference/androidx/camera/core/ImageCapture`.
`void` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#setImageCaptureIoExecutor(java.util.concurrent.Executor)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/util/concurrent/Executor.html executor)`

Sets the default executor that will be used for `https://developer.android.com/reference/androidx/camera/core/ImageCapture` IO tasks.
`void` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#setImageCaptureMode(int)(int captureMode)`

Sets the image capture mode.
`void` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#setImageCaptureResolutionSelector(androidx.camera.core.resolutionselector.ResolutionSelector)(

@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/camera/core/resolutionselector/ResolutionSelector resolutionSelector

)`

Sets the `https://developer.android.com/reference/androidx/camera/core/resolutionselector/ResolutionSelector` for `https://developer.android.com/reference/androidx/camera/core/ImageCapture`.
`void` `@https://developer.android.com/reference/androidx/annotation/MainThread
[setImageCaptureTargetSize](https://developer.android.com/reference/androidx/camera/view/CameraController#setImageCaptureTargetSize(androidx.camera.view.CameraController.OutputSize))(

@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/camera/view/CameraController.OutputSize targetSize

)`

**This method is deprecated.**

Use `https://developer.android.com/reference/androidx/camera/view/CameraController#setImageCaptureResolutionSelector(androidx.camera.core.resolutionselector.ResolutionSelector)` instead.

<br />

`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<https://developer.android.com/reference/java/lang/Void.html>` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#setLinearZoom(float)(@https://developer.android.com/reference/androidx/annotation/FloatRange(from = 0.0, to = 1.0) float linearZoom)`

Sets current zoom by a linear zoom value ranging from 0f to 1.0f.
`void` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#setPinchToZoomEnabled(boolean)(boolean enabled)`

Enables/disables pinch-to-zoom.
`void` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#setPreviewResolutionSelector(androidx.camera.core.resolutionselector.ResolutionSelector)(

@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/camera/core/resolutionselector/ResolutionSelector resolutionSelector

)`

Sets the `https://developer.android.com/reference/androidx/camera/core/resolutionselector/ResolutionSelector` for `https://developer.android.com/reference/androidx/camera/core/Preview`.
`void` `@https://developer.android.com/reference/androidx/annotation/MainThread
[setPreviewTargetSize](https://developer.android.com/reference/androidx/camera/view/CameraController#setPreviewTargetSize(androidx.camera.view.CameraController.OutputSize))(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/camera/view/CameraController.OutputSize targetSize)`

**This method is deprecated.**

Use `https://developer.android.com/reference/androidx/camera/view/CameraController#setPreviewResolutionSelector(androidx.camera.core.resolutionselector.ResolutionSelector)` instead.

<br />

`void` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#setSessionConfig(androidx.camera.core.SessionConfig,androidx.camera.core.CameraSelector)(

@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/core/SessionConfig sessionConfig,

@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/core/CameraSelector cameraSelector

)`

Sets the `https://developer.android.com/reference/androidx/camera/core/SessionConfig` with the `https://developer.android.com/reference/androidx/camera/core/CameraSelector` for the CameraController.
`void` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#setTapToFocusAutoCancelDuration(long,java.util.concurrent.TimeUnit)(

@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) long duration,

@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/concurrent/TimeUnit.html timeUnit

)`

Sets the auto-cancel duration for tap-to-focus events.
`void` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#setTapToFocusEnabled(boolean)(boolean enabled)`

Enables/disables tap-to-focus.
`void` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#setVideoCaptureDynamicRange(androidx.camera.core.DynamicRange)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/core/DynamicRange dynamicRange)`

Sets the `https://developer.android.com/reference/androidx/camera/core/DynamicRange` for video capture.
`void` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#setVideoCaptureMirrorMode(int)(int mirrorMode)`

Sets the mirror mode for video capture.
`void` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#setVideoCaptureQualitySelector(androidx.camera.video.QualitySelector)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/video/QualitySelector qualitySelector)`

Sets the `https://developer.android.com/reference/androidx/camera/video/QualitySelector` for `https://developer.android.com/reference/androidx/camera/view/CameraController#VIDEO_CAPTURE()`.
`void` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#setVideoCaptureTargetFrameRate(android.util.Range<java.lang.Integer>)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/util/Range.html<https://developer.android.com/reference/java/lang/Integer.html> targetFrameRate)`

Sets the target frame rate range in frames per second for video capture.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://guava.dev/releases/snapshot-android/api/docs/com/google/common/util/concurrent/ListenableFuture.html<https://developer.android.com/reference/java/lang/Void.html>` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#setZoomRatio(float)(float zoomRatio)`

Sets current zoom by ratio.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/video/Recording` `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 26)

@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#startRecording(androidx.camera.video.FileDescriptorOutputOptions,androidx.camera.view.video.AudioConfig,java.util.concurrent.Executor,androidx.core.util.Consumer<androidx.camera.video.VideoRecordEvent>)(

@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/video/FileDescriptorOutputOptions outputOptions,

@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/view/video/AudioConfig audioConfig,

@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/concurrent/Executor.html executor,

@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/util/Consumer<https://developer.android.com/reference/androidx/camera/video/VideoRecordEvent> listener

)`

Takes a video to a given file descriptor.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/video/Recording` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#startRecording(androidx.camera.video.FileOutputOptions,androidx.camera.view.video.AudioConfig,java.util.concurrent.Executor,androidx.core.util.Consumer<androidx.camera.video.VideoRecordEvent>)(

@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/video/FileOutputOptions outputOptions,

@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/view/video/AudioConfig audioConfig,

@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/concurrent/Executor.html executor,

@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/util/Consumer<https://developer.android.com/reference/androidx/camera/video/VideoRecordEvent> listener

)`

Takes a video to a given file.
`@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/video/Recording` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#startRecording(androidx.camera.video.MediaStoreOutputOptions,androidx.camera.view.video.AudioConfig,java.util.concurrent.Executor,androidx.core.util.Consumer<androidx.camera.video.VideoRecordEvent>)(

@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/video/MediaStoreOutputOptions outputOptions,

@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/view/video/AudioConfig audioConfig,

@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/concurrent/Executor.html executor,

@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/util/Consumer<https://developer.android.com/reference/androidx/camera/video/VideoRecordEvent> listener

)`

Takes a video to MediaStore.
`void` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#takePicture(java.util.concurrent.Executor,androidx.camera.core.ImageCapture.OnImageCapturedCallback)(

@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/concurrent/Executor.html executor,

@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/core/ImageCapture.OnImageCapturedCallback callback

)`

Captures a new still image for in memory access.
`void` `@https://developer.android.com/reference/androidx/annotation/MainThread
https://developer.android.com/reference/androidx/camera/view/CameraController#takePicture(androidx.camera.core.ImageCapture.OutputFileOptions,java.util.concurrent.Executor,androidx.camera.core.ImageCapture.OnImageSavedCallback)(

@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/core/ImageCapture.OutputFileOptions outputFileOptions,

@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/concurrent/Executor.html executor,

@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/core/ImageCapture.OnImageSavedCallback imageSavedCallback

)`

Captures a new still image and saves to a file along with application specified metadata.

## Public constructors

### LifecycleCameraController

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

```
public LifecycleCameraController(@NonNull Context context)
```

## Public methods

### bindToLifecycle

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

```
@MainThread
public void bindToLifecycle(@NonNull LifecycleOwner lifecycleOwner)
```

Sets the `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner` to be bound with the controller.

The state of the lifecycle will determine when the cameras are open, started, stopped and closed. When the `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner`'s state is start or greater, the controller receives camera data. It stops once the `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner` is destroyed.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | If the provided camera selector is unable to resolve a camera to be used for the given use cases. |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/camera/lifecycle/ProcessCameraProvider#bindToLifecycle(androidx.lifecycle.LifecycleOwner,androidx.camera.core.CameraSelector,androidx.camera.core.UseCase...)` |   |

### unbind

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

```
@MainThread
public void unbind()
```

Clears the previously set `https://developer.android.com/reference/androidx/lifecycle/LifecycleOwner` and stops the camera.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/camera/lifecycle/ProcessCameraProvider#unbindAll()` |   |