# AnimatorInflater

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

# AnimatorInflater

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/animation/AnimatorInflater "View this page in Kotlin")\|Java

`
public


class
AnimatorInflater
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

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

<br />

*** ** * ** ***

This class is used to instantiate animator XML files into Animator objects.

For performance reasons, inflation relies heavily on pre-processing of XML files that is done at build time. Therefore, it is not currently possible to use this inflater with an XmlPullParser over a plain XML file at runtime; it only works with an XmlPullParser returned from a compiled resource (R.*something*file.)

## Summary

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

|                                                                                                                                                                                                                          ### Public methods                                                                                                                                                                                                                          ||
|------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` static `[Animator](https://developer.android.com/reference/android/animation/Animator)                   | ` `[loadAnimator](https://developer.android.com/reference/android/animation/AnimatorInflater#loadAnimator(android.content.Context,%20int))`(`[Context](https://developer.android.com/reference/android/content/Context)` context, int id) ` Loads an[Animator](https://developer.android.com/reference/android/animation/Animator)object from a resource |
| ` static `[StateListAnimator](https://developer.android.com/reference/android/animation/StateListAnimator) | ` `[loadStateListAnimator](https://developer.android.com/reference/android/animation/AnimatorInflater#loadStateListAnimator(android.content.Context,%20int))`(`[Context](https://developer.android.com/reference/android/content/Context)` context, int id) `                                                                                            |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](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 `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](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`                                                                  | ` `[wait](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`                                                                  | ` `[wait](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*.                                                                                             | ||

## Public constructors

### AnimatorInflater

```
public AnimatorInflater ()
```

<br />

<br />

## Public methods

### loadAnimator

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

```
public static Animator loadAnimator (Context context, 
                int id)
```

Loads an[Animator](https://developer.android.com/reference/android/animation/Animator)object from a resource

<br />

|                                Parameters                                 ||
|-----------|----------------------------------------------------------------|
| `context` | `Context`: Application context used to access resources <br /> |
| `id`      | `int`: The resource id of the animation to load <br />         |

|                                                                 Returns                                                                  ||
|--------------------------------------------------------------------------------|----------------------------------------------------------|
| [Animator](https://developer.android.com/reference/android/animation/Animator) | The animator object reference by the specified id <br /> |

|                                                                           Throws                                                                            ||
|------------------------------------------------------------------------------------------------------------------------|-------------------------------------|
| [Resources.NotFoundException](https://developer.android.com/reference/android/content/res/Resources.NotFoundException) | when the animation cannot be loaded |

### loadStateListAnimator

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

```
public static StateListAnimator loadStateListAnimator (Context context, 
                int id)
```

<br />

<br />

|         Parameters          ||
|-----------|------------------|
| `context` | `Context` <br /> |
| `id`      | `int` <br />     |

|                                                 Returns                                                  ||
|--------------------------------------------------------------------------------------------------|--------|
| [StateListAnimator](https://developer.android.com/reference/android/animation/StateListAnimator) | <br /> |

|                                                          Throws                                                           ||
|------------------------------------------------------------------------------------------------------------------------|---|
| [Resources.NotFoundException](https://developer.android.com/reference/android/content/res/Resources.NotFoundException) |   |