RunnableScheduler

public interface RunnableScheduler


Can be used to schedule Runnables after a delay in milliseconds. This is used by the in-process scheduler to schedule timed work.

Summary

Public methods

abstract void
cancel(@NonNull Runnable runnable)

Cancels the Runnable which was previously scheduled using scheduleWithDelay.

abstract void
scheduleWithDelay(
    @IntRange(from = 0) long delayInMillis,
    @NonNull Runnable runnable
)

Schedules a Runnable to run after a delay (in milliseconds).

Public methods

cancel

Added in 2.4.0
abstract void cancel(@NonNull Runnable runnable)

Cancels the Runnable which was previously scheduled using scheduleWithDelay.

Parameters
@NonNull Runnable runnable

The Runnable to be cancelled

scheduleWithDelay

Added in 2.4.0
abstract void scheduleWithDelay(
    @IntRange(from = 0) long delayInMillis,
    @NonNull Runnable runnable
)

Schedules a Runnable to run after a delay (in milliseconds).

Parameters
@IntRange(from = 0) long delayInMillis

The delay in milliseconds relative to the current time.

@NonNull Runnable runnable

The Runnable to be scheduled