CameraXExecutors

class CameraXExecutors
kotlin.Any
   ↳ androidx.camera.core.impl.utils.executor.CameraXExecutors

Utility class for generating specific implementations of Executor.

Summary

Public methods

static Executor!

Returns a cached executor that runs tasks directly from the calling thread.

static Executor!

Returns a cached Executor suitable for disk I/O.

static Executor!

Returns a cached Executor which posts to the main thread.

static Executor!

Returns an executor which posts to the thread's current Looper.

static Executor!
newHandlerExecutor(@NonNull handler: Handler)

Returns an executor which posts to the given Handler.

static Executor!
newSequentialExecutor(@NonNull delegate: Executor)

Returns a new executor which will perform all tasks sequentially.

Public methods

directExecutor

static fun directExecutor(): Executor!

Returns a cached executor that runs tasks directly from the calling thread.

ioExecutor

static fun ioExecutor(): Executor!

Returns a cached Executor suitable for disk I/O.

mainThreadExecutor

static fun mainThreadExecutor(): Executor!

Returns a cached Executor which posts to the main thread.

myLooperExecutor

static fun myLooperExecutor(): Executor!

Returns an executor which posts to the thread's current Looper.

Return
Executor!: An executor which posts to the thread's current looper.
Exceptions
IllegalStateException if the current thread does not have a looper.

newHandlerExecutor

static fun newHandlerExecutor(@NonNull handler: Handler): Executor!

Returns an executor which posts to the given Handler.

Return
Executor!: An executor which posts to the given handler.

newSequentialExecutor

static fun newSequentialExecutor(@NonNull delegate: Executor): Executor!

Returns a new executor which will perform all tasks sequentially.

The returned executor delegates all tasks to the provided delegate Executor, but will ensure all tasks are run in order and without overlapping. Note this can only be guaranteed for tasks that are submitted via the same sequential executor. Tasks submitted directly to the delegate or to different instances of the sequential executor do not have any ordering guarantees.