Stay organized with collections
Save and categorize content based on your preferences.
Delayed
interface Delayed : Comparable<Delayed!>
Known Indirect Subclasses
|
A mix-in style interface for marking objects that should be acted upon after a given delay.
An implementation of this interface must define a compareTo
method that provides an ordering consistent with its getDelay
method.
Summary
Public methods |
abstract Long |
Returns the remaining delay associated with this object, in the given time unit.
|
Public methods
getDelay
abstract fun getDelay(unit: TimeUnit!): Long
Returns the remaining delay associated with this object, in the given time unit.
Parameters |
unit |
TimeUnit!: the time unit |
Return |
Long |
the remaining delay; zero or negative values indicate that the delay has already elapsed |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# Delayed\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nDelayed\n=======\n\n```\ninterface Delayed : Comparable\u003cDelayed!\u003e\n```\n\n|-----------------------------------|\n| [java.util.concurrent.Delayed](#) |\n\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known Direct Subclasses [ScheduledFuture](/reference/kotlin/java/util/concurrent/ScheduledFuture) |---------------------------------------------------------------------------|--------------------------------------------------------| | [ScheduledFuture](/reference/kotlin/java/util/concurrent/ScheduledFuture) | A delayed result-bearing action that can be cancelled. | |\n\n|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known Indirect Subclasses [RunnableScheduledFuture](/reference/kotlin/java/util/concurrent/RunnableScheduledFuture) |-------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------| | [RunnableScheduledFuture](/reference/kotlin/java/util/concurrent/RunnableScheduledFuture) | A [ScheduledFuture](/reference/kotlin/java/util/concurrent/ScheduledFuture) that is [Runnable](../../lang/Runnable.html#). | |\n\nA mix-in style interface for marking objects that should be acted upon after a given delay.\n\nAn implementation of this interface must define a `compareTo` method that provides an ordering consistent with its `getDelay` method.\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html) | [getDelay](#getDelay(java.util.concurrent.TimeUnit))`(`unit:` `[TimeUnit](/reference/kotlin/java/util/concurrent/TimeUnit)!`)` Returns the remaining delay associated with this object, in the given time unit. |\n\nPublic methods\n--------------\n\n### getDelay\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun getDelay(unit: TimeUnit!): Long\n```\n\nReturns the remaining delay associated with this object, in the given time unit.\n\n| Parameters ||\n|--------|-----------------------------------------------------------------------------|\n| `unit` | [TimeUnit](/reference/kotlin/java/util/concurrent/TimeUnit)!: the time unit |\n\n| Return ||\n|------------------------------------------------------------------------------|------------------------------------------------------------------------------------------|\n| [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html) | the remaining delay; zero or negative values indicate that the delay has already elapsed |"]]