UseCase

public abstract class UseCase
extends Object

java.lang.Object
   ↳ 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

UseCase(UseCaseConfig<?> useCaseConfig)

Creates a named instance of the use case.

Public methods

String getName()

Protected methods

void clear()

Clears internal state of this use case.

abstract Map<String, Size> onSuggestedResolutionUpdated(Map<String, Size> suggestedResolutionMap)

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

void setImageFormat(int imageFormat)

Inherited methods

Protected constructors

UseCase

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

public String getName ()

Returns
String

Protected methods

clear

protected void clear ()

Clears internal state of this use case.

onSuggestedResolutionUpdated

protected abstract Map<String, Size> onSuggestedResolutionUpdated (Map<String, Size> suggestedResolutionMap)

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

Parameters
suggestedResolutionMap Map: A map of the names of the CameraDevice to the suggested resolution that depends on camera device capability and what and how many use cases will be bound.

Returns
Map<String, Size> The map with the resolutions that finally used to create the SessionConfig to attach to the camera device.

setImageFormat

protected void setImageFormat (int imageFormat)

Parameters
imageFormat int