Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/android/animation/Animator#nestedclasses) \| [Constants](https://developer.android.com/reference/android/animation/Animator#constants) \| [Ctors](https://developer.android.com/reference/android/animation/Animator#pubctors) \| [Methods](https://developer.android.com/reference/android/animation/Animator#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/animation/Animator#inhmethods)

# Animator

*** ** * ** ***

` public abstract class Animator `   
` extends https://developer.android.com/reference/java/lang/Object ` ` implements https://developer.android.com/reference/java/lang/Cloneable `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.animation.Animator |

Known direct subclasses [AnimatorSet](https://developer.android.com/reference/android/animation/AnimatorSet), [ValueAnimator](https://developer.android.com/reference/android/animation/ValueAnimator) [AnimatorSet](https://developer.android.com/reference/android/animation/AnimatorSet) This class plays a set of `https://developer.android.com/reference/android/animation/Animator` objects in the specified order. [ValueAnimator](https://developer.android.com/reference/android/animation/ValueAnimator) This class provides a simple timing engine for running animations which calculate animated values and set them on target objects. Known indirect subclasses [ObjectAnimator](https://developer.android.com/reference/android/animation/ObjectAnimator), [TimeAnimator](https://developer.android.com/reference/android/animation/TimeAnimator) [ObjectAnimator](https://developer.android.com/reference/android/animation/ObjectAnimator) This subclass of `https://developer.android.com/reference/android/animation/ValueAnimator` provides support for animating properties on target objects. [TimeAnimator](https://developer.android.com/reference/android/animation/TimeAnimator) This class provides a simple callback mechanism to listeners that is synchronized with all other animators in the system.   

*** ** * ** ***

This is the superclass for classes which provide basic support for animations which can be started, ended, and have `AnimatorListeners` added to them.

## Summary

| ### Nested classes ||
|---|---|
| ` interface` | `https://developer.android.com/reference/android/animation/Animator.AnimatorListener` <br /> An animation listener receives notifications from an animation. |
| ` interface` | `https://developer.android.com/reference/android/animation/Animator.AnimatorPauseListener` A pause listener receives notifications from an animation when the animation is `https://developer.android.com/reference/android/animation/Animator#pause()` or `https://developer.android.com/reference/android/animation/Animator#resume()`. |

| ### Constants ||
|---|---|
| `long` | `https://developer.android.com/reference/android/animation/Animator#DURATION_INFINITE` The value used to indicate infinite duration (e.g. when Animators repeat infinitely). |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/animation/Animator#Animator()() ` |

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/animation/Animator#addListener(android.animation.Animator.AnimatorListener)(https://developer.android.com/reference/android/animation/Animator.AnimatorListener listener) ` Adds a listener to the set of listeners that are sent events through the life of an animation, such as start, repeat, and end. |
| ` void` | ` https://developer.android.com/reference/android/animation/Animator#addPauseListener(android.animation.Animator.AnimatorPauseListener)(https://developer.android.com/reference/android/animation/Animator.AnimatorPauseListener listener) ` Adds a pause listener to this animator. |
| ` void` | ` https://developer.android.com/reference/android/animation/Animator#cancel()() ` Cancels the animation. |
| ` https://developer.android.com/reference/android/animation/Animator` | ` https://developer.android.com/reference/android/animation/Animator#clone()() ` Creates and returns a copy of this object. |
| ` void` | ` https://developer.android.com/reference/android/animation/Animator#end()() ` Ends the animation. |
| ` abstract long` | ` https://developer.android.com/reference/android/animation/Animator#getDuration()() ` Gets the duration of the animation. |
| ` https://developer.android.com/reference/android/animation/TimeInterpolator` | ` https://developer.android.com/reference/android/animation/Animator#getInterpolator()() ` Returns the timing interpolator that this animation uses. |
| ` https://developer.android.com/reference/java/util/ArrayList<https://developer.android.com/reference/android/animation/Animator.AnimatorListener>` | ` https://developer.android.com/reference/android/animation/Animator#getListeners()() ` Gets the set of `https://developer.android.com/reference/android/animation/Animator.AnimatorListener` objects that are currently listening for events on this `Animator` object. |
| ` abstract long` | ` https://developer.android.com/reference/android/animation/Animator#getStartDelay()() ` The amount of time, in milliseconds, to delay processing the animation after `https://developer.android.com/reference/android/animation/Animator#start()` is called. |
| ` long` | ` https://developer.android.com/reference/android/animation/Animator#getTotalDuration()() ` Gets the total duration of the animation, accounting for animation sequences, start delay, and repeating. |
| ` boolean` | ` https://developer.android.com/reference/android/animation/Animator#isPaused()() ` Returns whether this animator is currently in a paused state. |
| ` abstract boolean` | ` https://developer.android.com/reference/android/animation/Animator#isRunning()() ` Returns whether this Animator is currently running (having been started and gone past any initial startDelay period and not yet ended). |
| ` boolean` | ` https://developer.android.com/reference/android/animation/Animator#isStarted()() ` Returns whether this Animator has been started and not yet ended. |
| ` void` | ` https://developer.android.com/reference/android/animation/Animator#pause()() ` Pauses a running animation. |
| ` void` | ` https://developer.android.com/reference/android/animation/Animator#removeAllListeners()() ` Removes all `https://developer.android.com/reference/android/animation/Animator#addListener(android.animation.Animator.AnimatorListener)` and `https://developer.android.com/reference/android/animation/Animator#addPauseListener(android.animation.Animator.AnimatorPauseListener)` from this object. |
| ` void` | ` https://developer.android.com/reference/android/animation/Animator#removeListener(android.animation.Animator.AnimatorListener)(https://developer.android.com/reference/android/animation/Animator.AnimatorListener listener) ` Removes a listener from the set listening to this animation. |
| ` void` | ` https://developer.android.com/reference/android/animation/Animator#removePauseListener(android.animation.Animator.AnimatorPauseListener)(https://developer.android.com/reference/android/animation/Animator.AnimatorPauseListener listener) ` Removes a pause listener from the set listening to this animation. |
| ` void` | ` https://developer.android.com/reference/android/animation/Animator#resume()() ` Resumes a paused animation, causing the animator to pick up where it left off when it was paused. |
| ` abstract https://developer.android.com/reference/android/animation/Animator` | ` https://developer.android.com/reference/android/animation/Animator#setDuration(long)(long duration) ` Sets the duration of the animation. |
| ` abstract void` | ` https://developer.android.com/reference/android/animation/Animator#setInterpolator(android.animation.TimeInterpolator)(https://developer.android.com/reference/android/animation/TimeInterpolator value) ` The time interpolator used in calculating the elapsed fraction of the animation. |
| ` abstract void` | ` https://developer.android.com/reference/android/animation/Animator#setStartDelay(long)(long startDelay) ` The amount of time, in milliseconds, to delay processing the animation after `https://developer.android.com/reference/android/animation/Animator#start()` is called. |
| ` void` | ` https://developer.android.com/reference/android/animation/Animator#setTarget(java.lang.Object)(https://developer.android.com/reference/java/lang/Object target) ` Sets the target object whose property will be animated by this animation. |
| ` void` | ` https://developer.android.com/reference/android/animation/Animator#setupEndValues()() ` This method tells the object to use appropriate information to extract ending values for the animation. |
| ` void` | ` https://developer.android.com/reference/android/animation/Animator#setupStartValues()() ` This method tells the object to use appropriate information to extract starting values for the animation. |
| ` void` | ` https://developer.android.com/reference/android/animation/Animator#start()() ` Starts this animation. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Constants

### DURATION_INFINITE

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final long DURATION_INFINITE
```

The value used to indicate infinite duration (e.g. when Animators repeat infinitely).

<br />

Constant Value: -1 (0xffffffffffffffff)

## Public constructors

### Animator

```
public Animator ()
```

<br />

<br />

## Public methods

### addListener

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void addListener (Animator.AnimatorListener listener)
```

Adds a listener to the set of listeners that are sent events through the life of an animation, such as start, repeat, and end.

<br />

| Parameters ||
|---|---|
| `listener` | `Animator.AnimatorListener`: the listener to be added to the current set of listeners for this animation. <br /> |

### addPauseListener

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void addPauseListener (Animator.AnimatorPauseListener listener)
```

Adds a pause listener to this animator.

<br />

| Parameters ||
|---|---|
| `listener` | `Animator.AnimatorPauseListener`: the listener to be added to the current set of pause listeners for this animation. <br /> |

### cancel

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void cancel ()
```

Cancels the animation. Unlike `https://developer.android.com/reference/android/animation/Animator#end()`, `cancel()` causes the animation to stop in its tracks, sending an `https://developer.android.com/reference/android/animation/Animator.AnimatorListener#onAnimationCancel(android.animation.Animator)` to its listeners, followed by an `https://developer.android.com/reference/android/animation/Animator.AnimatorListener#onAnimationEnd(android.animation.Animator)` message.

This method must be called on the thread that is running the animation.

<br />

<br />

### clone

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Animator clone ()
```

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object `x`, the expression:
>
> ```
> x.clone() != x
> ```
will be true, and that the expression:
>
> ```
> x.clone().getClass() == x.getClass()
> ```
will be `true`, but these are not absolute requirements. While it is typically the case that:
>
> ```
> x.clone().equals(x)
> ```
will be `true`, this is not an absolute requirement.

By convention, the returned object should be obtained by calling `super.clone`. If a class and all of its superclasses (except `Object`) obey this convention, it will be the case that `x.clone().getClass() == x.getClass()`.

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by `super.clone` before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by `super.clone` need to be modified.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/animation/Animator` | a clone of this instance. <br /> |

### end

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void end ()
```

Ends the animation. This causes the animation to assign the end value of the property being animated, then calling the `https://developer.android.com/reference/android/animation/Animator.AnimatorListener#onAnimationEnd(android.animation.Animator)` method on its listeners.

This method must be called on the thread that is running the animation.

<br />

<br />

### getDuration

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract long getDuration ()
```

Gets the duration of the animation.

<br />

| Returns ||
|---|---|
| `long` | The length of the animation, in milliseconds. <br /> |

### getInterpolator

Added in [API level 18](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public TimeInterpolator getInterpolator ()
```

Returns the timing interpolator that this animation uses.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/animation/TimeInterpolator` | The timing interpolator for this animation. <br /> |

### getListeners

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ArrayList<Animator.AnimatorListener> getListeners ()
```

Gets the set of `https://developer.android.com/reference/android/animation/Animator.AnimatorListener` objects that are currently listening for events on this `Animator` object.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/ArrayList<https://developer.android.com/reference/android/animation/Animator.AnimatorListener>` | ArrayList The set of listeners. <br /> |

### getStartDelay

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract long getStartDelay ()
```

The amount of time, in milliseconds, to delay processing the animation after `https://developer.android.com/reference/android/animation/Animator#start()` is called.

<br />

| Returns ||
|---|---|
| `long` | the number of milliseconds to delay running the animation <br /> |

### getTotalDuration

Added in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public long getTotalDuration ()
```

Gets the total duration of the animation, accounting for animation sequences, start delay, and repeating. Return `https://developer.android.com/reference/android/animation/Animator#DURATION_INFINITE` if the duration is infinite.

<br />

| Returns ||
|---|---|
| `long` | Total time an animation takes to finish, starting from the time `https://developer.android.com/reference/android/animation/Animator#start()` is called. `https://developer.android.com/reference/android/animation/Animator#DURATION_INFINITE` will be returned if the animation or any child animation repeats infinite times. <br /> |

### isPaused

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isPaused ()
```

Returns whether this animator is currently in a paused state.

<br />

| Returns ||
|---|---|
| `boolean` | True if the animator is currently paused, false otherwise. <br /> |

**See also:**

- `https://developer.android.com/reference/android/animation/Animator#pause()`
- `https://developer.android.com/reference/android/animation/Animator#resume()`

### isRunning

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract boolean isRunning ()
```

Returns whether this Animator is currently running (having been started and gone past any initial startDelay period and not yet ended).

<br />

| Returns ||
|---|---|
| `boolean` | Whether the Animator is running. <br /> |

### isStarted

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isStarted ()
```

Returns whether this Animator has been started and not yet ended. For reusable Animators (which most Animators are, apart from the one-shot animator produced by `https://developer.android.com/reference/android/view/ViewAnimationUtils#createCircularReveal(android.view.View,%20int,%20int,%20float,%20float)`), this state is a superset of `https://developer.android.com/reference/android/animation/Animator#isRunning()`, because an Animator with a nonzero `https://developer.android.com/reference/android/animation/Animator#getStartDelay()` will return true for `https://developer.android.com/reference/android/animation/Animator#isStarted()` during the delay phase, whereas `https://developer.android.com/reference/android/animation/Animator#isRunning()` will return true only after the delay phase is complete. Non-reusable animators will always return true after they have been started, because they cannot return to a non-started state.

<br />

| Returns ||
|---|---|
| `boolean` | Whether the Animator has been started and not yet ended. <br /> |

### pause

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void pause ()
```

Pauses a running animation. This method should only be called on the same thread on which the animation was started. If the animation has not yet been `https://developer.android.com/reference/android/animation/Animator#isStarted()` or has since ended, then the call is ignored. Paused animations can be resumed by calling `https://developer.android.com/reference/android/animation/Animator#resume()`.

<br />

**See also:**

- `https://developer.android.com/reference/android/animation/Animator#resume()`
- `https://developer.android.com/reference/android/animation/Animator#isPaused()`
- `https://developer.android.com/reference/android/animation/Animator.AnimatorPauseListener`

### removeAllListeners

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void removeAllListeners ()
```

Removes all `https://developer.android.com/reference/android/animation/Animator#addListener(android.animation.Animator.AnimatorListener)` and `https://developer.android.com/reference/android/animation/Animator#addPauseListener(android.animation.Animator.AnimatorPauseListener)` from this object.

<br />

### removeListener

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void removeListener (Animator.AnimatorListener listener)
```

Removes a listener from the set listening to this animation.

<br />

| Parameters ||
|---|---|
| `listener` | `Animator.AnimatorListener`: the listener to be removed from the current set of listeners for this animation. <br /> |

### removePauseListener

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void removePauseListener (Animator.AnimatorPauseListener listener)
```

Removes a pause listener from the set listening to this animation.

<br />

| Parameters ||
|---|---|
| `listener` | `Animator.AnimatorPauseListener`: the listener to be removed from the current set of pause listeners for this animation. <br /> |

### resume

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void resume ()
```

Resumes a paused animation, causing the animator to pick up where it left off when it was paused. This method should only be called on the same thread on which the animation was started. Calls to resume() on an animator that is not currently paused will be ignored.

<br />

**See also:**

- `https://developer.android.com/reference/android/animation/Animator#pause()`
- `https://developer.android.com/reference/android/animation/Animator#isPaused()`
- `https://developer.android.com/reference/android/animation/Animator.AnimatorPauseListener`

### setDuration

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract Animator setDuration (long duration)
```

Sets the duration of the animation.

<br />

| Parameters ||
|---|---|
| `duration` | `long`: The length of the animation, in milliseconds. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/animation/Animator` | <br /> |

### setInterpolator

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void setInterpolator (TimeInterpolator value)
```

The time interpolator used in calculating the elapsed fraction of the animation. The interpolator determines whether the animation runs with linear or non-linear motion, such as acceleration and deceleration. The default value is `https://developer.android.com/reference/android/view/animation/AccelerateDecelerateInterpolator`.

<br />

| Parameters ||
|---|---|
| `value` | `TimeInterpolator`: the interpolator to be used by this animation <br /> |

### setStartDelay

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void setStartDelay (long startDelay)
```

The amount of time, in milliseconds, to delay processing the animation after `https://developer.android.com/reference/android/animation/Animator#start()` is called.

<br />

| Parameters ||
|---|---|
| `startDelay` | `long`: The amount of the delay, in milliseconds <br /> |

### setTarget

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setTarget (Object target)
```

Sets the target object whose property will be animated by this animation. Not all subclasses operate on target objects (for example, `https://developer.android.com/reference/android/animation/ValueAnimator`, but this method is on the superclass for the convenience of dealing generically with those subclasses that do handle targets.

<br />

| Parameters ||
|---|---|
| `target` | `Object`: The object being animated. This value may be `null`. <br /> |

### setupEndValues

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setupEndValues ()
```

This method tells the object to use appropriate information to extract ending values for the animation. For example, a AnimatorSet object will pass this call to its child objects to tell them to set up the values. A ObjectAnimator object will use the information it has about its target object and PropertyValuesHolder objects to get the start values for its properties. A ValueAnimator object will ignore the request since it does not have enough information (such as a target object) to gather these values.

<br />

### setupStartValues

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setupStartValues ()
```

This method tells the object to use appropriate information to extract starting values for the animation. For example, a AnimatorSet object will pass this call to its child objects to tell them to set up the values. A ObjectAnimator object will use the information it has about its target object and PropertyValuesHolder objects to get the start values for its properties. A ValueAnimator object will ignore the request since it does not have enough information (such as a target object) to gather these values.

<br />

### start

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public 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 `https://developer.android.com/reference/android/animation/Animator.AnimatorListener#onAnimationStart(android.animation.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.

<br />

<br />