Stay organized with collections
Save and categorize content based on your preferences.
TimeListener
interface TimeListener
Implementors of this interface can set themselves as update listeners to a TimeAnimator
instance to receive callbacks on every animation frame to receive the total time since the animator started and the delta time since the last frame. The first time the listener is called, deltaTime will be zero. The same is true for totalTime, unless the animator was set to a specific currentPlayTime
prior to starting.
Summary
Public methods |
abstract Unit |
Notifies listeners of the occurrence of another frame of the animation, along with information about the elapsed time.
|
Public methods
onTimeUpdate
abstract fun onTimeUpdate(
animation: TimeAnimator!,
totalTime: Long,
deltaTime: Long
): Unit
Notifies listeners of the occurrence of another frame of the animation, along with information about the elapsed time.
Parameters |
animation |
TimeAnimator!: The animator sending out the notification. |
totalTime |
Long: The total time elapsed since the animator started, in milliseconds. |
deltaTime |
Long: The time elapsed since the previous frame, in milliseconds. |
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,["# TimeAnimator.TimeListener\n\nAdded in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nTimeListener\n============\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/animation/TimeAnimator.TimeListener \"View this page in Java\") \n\n```\ninterface TimeListener\n```\n\n|--------------------------------------------------|\n| [android.animation.TimeAnimator.TimeListener](#) |\n\nImplementors of this interface can set themselves as update listeners to a `TimeAnimator` instance to receive callbacks on every animation frame to receive the total time since the animator started and the delta time since the last frame. The first time the listener is called, deltaTime will be zero. The same is true for totalTime, unless the animator was set to a specific [currentPlayTime](/reference/kotlin/android/animation/ValueAnimator#setCurrentPlayTime(kotlin.Long)) prior to starting.\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onTimeUpdate](#onTimeUpdate(android.animation.TimeAnimator,%20kotlin.Long,%20kotlin.Long))`(`animation:` `[TimeAnimator](/reference/kotlin/android/animation/TimeAnimator)!`, `totalTime:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`, `deltaTime:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`)` Notifies listeners of the occurrence of another frame of the animation, along with information about the elapsed time. |\n\nPublic methods\n--------------\n\n### onTimeUpdate\n\nAdded in [API level 16](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onTimeUpdate(\n animation: TimeAnimator!, \n totalTime: Long, \n deltaTime: Long\n): Unit\n```\n\nNotifies listeners of the occurrence of another frame of the animation, along with information about the elapsed time.\n\n| Parameters ||\n|-------------|---------------------------------------------------------------------------------------------------------------------------------------------------|\n| `animation` | [TimeAnimator](/reference/kotlin/android/animation/TimeAnimator)!: The animator sending out the notification. |\n| `totalTime` | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html): The total time elapsed since the animator started, in milliseconds. |\n| `deltaTime` | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html): The time elapsed since the previous frame, in milliseconds. |"]]