UseCase

abstract class UseCase
kotlin.Any
   ↳ androidx.camera.core.UseCase

The use case which all other use cases are built on top of.

A UseCase provides functionality to map the set of arguments in a use case to arguments that are usable by a camera. UseCase also will communicate of the active/inactive state to the Camera.

Summary

Protected constructors

<init>(useCaseConfig: UseCaseConfig<*>!)

Creates a named instance of the use case.

Public methods

open String!

Protected methods

open Unit

Clears internal state of this use case.

abstract MutableMap<String!, Size!>!
onSuggestedResolutionUpdated(suggestedResolutionMap: MutableMap<String!, Size!>!)

Called when binding new use cases via CameraX#bindToLifecycle(LifecycleOwner, * UseCase...).

open Unit
setImageFormat(imageFormat: Int)

Protected constructors

<init>

protected UseCase(useCaseConfig: UseCaseConfig<*>!)

Creates a named instance of the use case.

Parameters
useCaseConfig UseCaseConfig<*>!: the configuration object used for this use case

Public methods

getName

open fun getName(): String!

Protected methods

clear

@CallSuper protected open fun clear(): Unit

Clears internal state of this use case.

onSuggestedResolutionUpdated

protected abstract fun onSuggestedResolutionUpdated(suggestedResolutionMap: MutableMap<String!, Size!>!): MutableMap<String!, Size!>!

Called when binding new use cases via CameraX#bindToLifecycle(LifecycleOwner, * UseCase...). Override to create necessary objects like android.media.ImageReader depending on the resolution.

Parameters
suggestedResolutionMap MutableMap<String!, Size!>!: A map of the names of the to the suggested resolution that depends on camera device capability and what and how many use cases will be bound.
Return
MutableMap<String!, Size!>!: The map with the resolutions that finally used to create the SessionConfig to attach to the camera device.

setImageFormat

protected open fun setImageFormat(imageFormat: Int): Unit