CameraXConfig.Builder
public
static
final
class
CameraXConfig.Builder
extends Object
java.lang.Object | |
↳ | androidx.camera.core.CameraXConfig.Builder |
A builder for generating CameraXConfig
objects.
Summary
Public methods | |
---|---|
CameraXConfig
|
build()
Builds an immutable |
static
CameraXConfig.Builder
|
fromConfig(CameraXConfig configuration)
Generates a Builder from another |
CameraXConfig.Builder
|
setAvailableCamerasLimiter(CameraSelector availableCameraSelector)
Sets a |
CameraXConfig.Builder
|
setCameraExecutor(Executor executor)
Sets an executor which CameraX will use to drive the camera stack. |
CameraXConfig.Builder
|
setMinimumLoggingLevel(int logLevel)
Sets the minimum logging level to be used for CameraX logs. |
CameraXConfig.Builder
|
setSchedulerHandler(Handler handler)
Sets a handler that CameraX will use internally for scheduling future tasks. |
Inherited methods | |
---|---|
Public methods
build
public CameraXConfig build ()
Builds an immutable CameraXConfig
from the current state.
Returns | |
---|---|
CameraXConfig |
A CameraXConfig populated with the current state.
|
fromConfig
public static CameraXConfig.Builder fromConfig (CameraXConfig configuration)
Generates a Builder from another CameraXConfig
object
Parameters | |
---|---|
configuration |
CameraXConfig : An immutable configuration to pre-populate this builder. |
Returns | |
---|---|
CameraXConfig.Builder |
The new Builder. |
setAvailableCamerasLimiter
public CameraXConfig.Builder setAvailableCamerasLimiter (CameraSelector availableCameraSelector)
Sets a CameraSelector
to determine the available cameras, thus defining which
cameras can be used in the application.
Only cameras selected by this CameraSelector can be used in the application. If the
application binds use cases with a CameraSelector that selects an unavailable camera,
an IllegalArgumentException
will be thrown.
This configuration can help CameraX optimize the latency of CameraX initialization.
The tasks CameraX initialization performs include enumerating cameras, querying
camera characteristics and retrieving properties in preparation for resolution
determination. On some low end devices, these tasks could take a significant amount of
time. Using this method can avoid the initialization of unnecessary cameras and speed
up the time for camera start-up. For example, if the application uses only back facing
cameras, it can set this configuration with CameraSelector.DEFAULT_BACK_CAMERA
and then CameraX will avoid initializing front facing cameras to reduce the latency.
Parameters | |
---|---|
availableCameraSelector |
CameraSelector |
Returns | |
---|---|
CameraXConfig.Builder |
setCameraExecutor
public CameraXConfig.Builder setCameraExecutor (Executor executor)
Sets an executor which CameraX will use to drive the camera stack.
This option can be used to override the default internal executor created by CameraX, and will be used by the implementation to drive all cameras.
It is not necessary to set an executor for normal use, and should only be used in applications with very specific threading requirements. If not set, CameraX will create and use an optimized default internal executor.
Parameters | |
---|---|
executor |
Executor |
Returns | |
---|---|
CameraXConfig.Builder |
setMinimumLoggingLevel
public CameraXConfig.Builder setMinimumLoggingLevel (int logLevel)
Sets the minimum logging level to be used for CameraX logs.
The logging level should be one of the following: Log.DEBUG
, Log.INFO
,
Log.WARN
or Log.ERROR
.
When not specified, the default minimum logging level used inside CameraX is
Log.DEBUG
.
Parameters | |
---|---|
logLevel |
int : The minimum logging level, which should be Log.DEBUG ,
Log.INFO , Log.WARN or Log.ERROR .Value is between 3 and 6 inclusive. |
Returns | |
---|---|
CameraXConfig.Builder |
This CameraXConfig.Builder instance.
|
setSchedulerHandler
public CameraXConfig.Builder setSchedulerHandler (Handler handler)
Sets a handler that CameraX will use internally for scheduling future tasks.
This scheduler may also be used for legacy APIs which require a Handler
. Tasks
that are scheduled with this handler will always be executed by the camera executor. No
business logic will be executed directly by this handler.
It is not necessary to set a scheduler handler for normal use, and should only be used in applications with very specific threading requirements. If not set, CameraX will create and use an optimized default internal handler.
Parameters | |
---|---|
handler |
Handler |
Returns | |
---|---|
CameraXConfig.Builder |
See also: