Stay organized with collections Save and categorize content based on your preferences.

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

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

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