Skip to content

Most visited

Recently visited



public class TimeAnimator
extends ValueAnimator

   ↳ android.animation.Animator
     ↳ android.animation.ValueAnimator
       ↳ android.animation.TimeAnimator

This class provides a simple callback mechanism to listeners that is synchronized with all other animators in the system. There is no duration, interpolation, or object value-setting with this Animator. Instead, it is simply started, after which it proceeds to send out events on every animation frame to its TimeListener (if set), with information about this animator, the total elapsed time, and the elapsed time since the previous animation frame.


Nested classes

interface TimeAnimator.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. 

Inherited constants

Public constructors


Public methods

void setCurrentPlayTime(long playTime)

Sets the position of the animation to the specified point in time.

void setTimeListener(TimeAnimator.TimeListener listener)

Sets a listener that is sent update events throughout the life of an animation.

void start()

Starts this animation.

Inherited methods

Public constructors


added in API level 16
TimeAnimator ()

Public methods


added in API level 16
void setCurrentPlayTime (long playTime)

Sets the position of the animation to the specified point in time. This time should be between 0 and the total duration of the animation, including any repetition. If the animation has not yet been started, then it will not advance forward after it is set to this time; it will simply set the time to this value and perform any appropriate actions based on that time. If the animation is already running, then setCurrentPlayTime() will set the current playing time to this value and continue playing from that point.

playTime long: The time, in milliseconds, to which the animation is advanced or rewound.


added in API level 16
void setTimeListener (TimeAnimator.TimeListener listener)

Sets a listener that is sent update events throughout the life of an animation.

listener TimeAnimator.TimeListener: the listener to be set.


added in API level 16
void start ()

Starts this animation. If the animation has a nonzero startDelay, the animation will start running after that delay elapses. A non-delayed animation will have its initial value(s) set immediately, followed by calls to onAnimationStart(Animator) for any listeners of this animator.

The animation started by calling this method will be run on the thread that called this method. This thread should have a Looper on it (a runtime exception will be thrown if this is not the case). Also, if the animation will animate properties of objects in the view hierarchy, then the calling thread should be the UI thread for that view hierarchy.

This site uses cookies to store your preferences for site-specific language and display options.

Get the latest Android developer news and tips that will help you find success on Google Play.

* Required Fields


Follow Google Developers on WeChat

Browse this site in ?

You requested a page in , but your language preference for this site is .

Would you like to change your language preference and browse this site in ? If you want to change your language preference later, use the language menu at the bottom of each page.

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a short survey?
Help us improve the Android developer experience. (April 2018 — Developer Survey)