# AnimatorInflater

Artifact: [androidx.core:core-animation](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/animation/AnimatorInflater.java+class:androidx.core.animation.AnimatorInflater) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core#1.0.0)

*** ** * ** ***


```
public class 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 methods |
|---|---|
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/animation/Animator` | `https://developer.android.com/reference/androidx/core/animation/AnimatorInflater#loadAnimator(android.content.Context,int)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context, @https://developer.android.com/reference/androidx/annotation/AnimatorRes int id)` Loads an `https://developer.android.com/reference/androidx/core/animation/Animator` object from a resource |
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/animation/Animator` | `https://developer.android.com/reference/androidx/core/animation/AnimatorInflater#loadAnimator(android.content.res.Resources,android.content.res.Resources.Theme,int)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/res/Resources.html resources, @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/content/res/Resources.Theme.html theme, @https://developer.android.com/reference/androidx/annotation/AnimatorRes int id )` Loads an `https://developer.android.com/reference/androidx/core/animation/Animator` object from a resource |
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/animation/Interpolator` | `https://developer.android.com/reference/androidx/core/animation/AnimatorInflater#loadInterpolator(android.content.Context,int)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context, @https://developer.android.com/reference/androidx/annotation/AnimatorRes @https://developer.android.com/reference/androidx/annotation/InterpolatorRes int id )` Loads an `https://developer.android.com/reference/androidx/core/animation/Interpolator` object from a resource |

## Public methods

### loadAnimator

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core#1.0.0)

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

Loads an `https://developer.android.com/reference/androidx/core/animation/Animator` object from a resource

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context` | Application context used to access resources |
| `@https://developer.android.com/reference/androidx/annotation/AnimatorRes int id` | The resource id of the animation to load |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/animation/Animator` | The animator object reference by the specified id |

| Throws |
|---|---|
| `https://developer.android.com/reference/android/content/res/Resources.NotFoundException.html` | when the animation cannot be loaded |

### loadAnimator

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core#1.0.0)

```
public static @NonNull Animator loadAnimator(
    @NonNull Resources resources,
    @Nullable Resources.Theme theme,
    @AnimatorRes int id
)
```

Loads an `https://developer.android.com/reference/androidx/core/animation/Animator` object from a resource

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/res/Resources.html resources` | The resources |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/content/res/Resources.Theme.html theme` | The theme |
| `@https://developer.android.com/reference/androidx/annotation/AnimatorRes int id` | The resource id of the animation to load |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/animation/Animator` | The animator object reference by the specified id |

| Throws |
|---|---|
| `https://developer.android.com/reference/android/content/res/Resources.NotFoundException.html` | when the animation cannot be loaded |

### loadInterpolator

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/core#1.0.0)

```
public static @NonNull Interpolator loadInterpolator(
    @NonNull Context context,
    @AnimatorRes @InterpolatorRes int id
)
```

Loads an `https://developer.android.com/reference/androidx/core/animation/Interpolator` object from a resource

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context` | Application context used to access resources |
| `@https://developer.android.com/reference/androidx/annotation/AnimatorRes @https://developer.android.com/reference/androidx/annotation/InterpolatorRes int id` | The resource id of the animation to load |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/animation/Interpolator` | The animation object reference by the specified id |

| Throws |
|---|---|
| `https://developer.android.com/reference/android/content/res/Resources.NotFoundException.html` | when interpolator resources cannot be loaded |