# Animatable2

Added in[API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Nested Classes](https://developer.android.com/reference/android/graphics/drawable/Animatable2#nestedclasses)\|[Methods](https://developer.android.com/reference/android/graphics/drawable/Animatable2#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/graphics/drawable/Animatable2#inhmethods)  

# Animatable2

*** ** * ** ***

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

`
public


interface
Animatable2
`  
`


implements

`[Animatable](https://developer.android.com/reference/android/graphics/drawable/Animatable)`


`

|---------------------------------------|
| android.graphics.drawable.Animatable2 |

|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known indirect subclasses [AnimatedImageDrawable](https://developer.android.com/reference/android/graphics/drawable/AnimatedImageDrawable),[AnimatedVectorDrawable](https://developer.android.com/reference/android/graphics/drawable/AnimatedVectorDrawable) |--------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [AnimatedImageDrawable](https://developer.android.com/reference/android/graphics/drawable/AnimatedImageDrawable)   | [Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable)for drawing animated images (like GIF).                                                                                                                                                                                                                       | | [AnimatedVectorDrawable](https://developer.android.com/reference/android/graphics/drawable/AnimatedVectorDrawable) | This class animates properties of a[VectorDrawable](https://developer.android.com/reference/android/graphics/drawable/VectorDrawable)with animations defined using[ObjectAnimator](https://developer.android.com/reference/android/animation/ObjectAnimator)or[AnimatorSet](https://developer.android.com/reference/android/animation/AnimatorSet). | |

<br />

*** ** * ** ***

Abstract class that drawables supporting animations and callbacks should extend.

## Summary

|                                                                ### Nested classes                                                                 ||
|----------|-----------------------------------------------------------------------------------------------------------------------------------------|
| ` class` | [Animatable2.AnimationCallback](https://developer.android.com/reference/android/graphics/drawable/Animatable2.AnimationCallback) <br /> |

|                                                                                                                                                                                                    ### Public methods                                                                                                                                                                                                    ||
|---------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` abstract void`    | ` `[clearAnimationCallbacks](https://developer.android.com/reference/android/graphics/drawable/Animatable2#clearAnimationCallbacks())`() ` Removes all existing animation callbacks.                                                                                                                                                                                                                |
| ` abstract void`    | ` `[registerAnimationCallback](https://developer.android.com/reference/android/graphics/drawable/Animatable2#registerAnimationCallback(android.graphics.drawable.Animatable2.AnimationCallback))`(`[Animatable2.AnimationCallback](https://developer.android.com/reference/android/graphics/drawable/Animatable2.AnimationCallback)` callback) ` Adds a callback to listen to the animation events. |
| ` abstract boolean` | ` `[unregisterAnimationCallback](https://developer.android.com/reference/android/graphics/drawable/Animatable2#unregisterAnimationCallback(android.graphics.drawable.Animatable2.AnimationCallback))`(`[Animatable2.AnimationCallback](https://developer.android.com/reference/android/graphics/drawable/Animatable2.AnimationCallback)` callback) ` Removes the specified animation callback.      |

| ### Inherited methods |
|-----------------------|---|
| From interface` `[android.graphics.drawable.Animatable](https://developer.android.com/reference/android/graphics/drawable/Animatable)` ` |---------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract boolean` | ` `[isRunning](https://developer.android.com/reference/android/graphics/drawable/Animatable#isRunning())`() ` Indicates whether the animation is running. | | ` abstract void`    | ` `[start](https://developer.android.com/reference/android/graphics/drawable/Animatable#start())`() ` Starts the drawable's animation.                    | | ` abstract void`    | ` `[stop](https://developer.android.com/reference/android/graphics/drawable/Animatable#stop())`() ` Stops the drawable's animation.                       | ||

## Public methods

### clearAnimationCallbacks

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

```
public abstract void clearAnimationCallbacks ()
```

Removes all existing animation callbacks.

<br />

### registerAnimationCallback

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

```
public abstract void registerAnimationCallback (Animatable2.AnimationCallback callback)
```

Adds a callback to listen to the animation events.

<br />

|                                            Parameters                                            ||
|------------|--------------------------------------------------------------------------------------|
| `callback` | `Animatable2.AnimationCallback`: Callback to add. This value cannot be`null`. <br /> |

### unregisterAnimationCallback

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

```
public abstract boolean unregisterAnimationCallback (Animatable2.AnimationCallback callback)
```

Removes the specified animation callback.

<br />

|                                             Parameters                                              ||
|------------|-----------------------------------------------------------------------------------------|
| `callback` | `Animatable2.AnimationCallback`: Callback to remove. This value cannot be`null`. <br /> |

|                                                           Returns                                                           ||
|-----------|------------------------------------------------------------------------------------------------------------------|
| `boolean` | `false`if callback didn't exist in the call back list, or`true`if callback has been removed successfully. <br /> |