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

# Drawable.ConstantState

*** ** * ** ***

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


`
public
static

abstract
class
Drawable.ConstantState
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.graphics.drawable.Drawable.ConstantState |

|---|
| Known direct subclasses [DrawableContainer.DrawableContainerState](https://developer.android.com/reference/android/graphics/drawable/DrawableContainer.DrawableContainerState) |---|---| | [DrawableContainer.DrawableContainerState](https://developer.android.com/reference/android/graphics/drawable/DrawableContainer.DrawableContainerState) | A ConstantState that can contain several `https://developer.android.com/reference/android/graphics/drawable/Drawable`s. | |

<br />

*** ** * ** ***

This abstract class is used by `https://developer.android.com/reference/android/graphics/drawable/Drawable`s to store shared constant state and data
between Drawables. `https://developer.android.com/reference/android/graphics/drawable/BitmapDrawable`s created from the same resource will for instance
share a unique bitmap stored in their ConstantState.


`https://developer.android.com/reference/android/graphics/drawable/Drawable.ConstantState#newDrawable(android.content.res.Resources)` can be used as a factory to create new Drawable instances
from this ConstantState.
Use `https://developer.android.com/reference/android/graphics/drawable/Drawable#getConstantState()` to retrieve the ConstantState of a Drawable. Calling `https://developer.android.com/reference/android/graphics/drawable/Drawable#mutate()` on a Drawable should typically create a new ConstantState for that Drawable.

<br />

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/graphics/drawable/Drawable.ConstantState#ConstantState()() ` |

| ### Public methods ||
|---|---|
| ` boolean` | ` https://developer.android.com/reference/android/graphics/drawable/Drawable.ConstantState#canApplyTheme()() ` Return whether this constant state can have a theme applied. |
| ` abstract int` | ` https://developer.android.com/reference/android/graphics/drawable/Drawable.ConstantState#getChangingConfigurations()() ` Return a bit mask of configuration changes that will impact this drawable (and thus require completely reloading it). |
| ` https://developer.android.com/reference/android/graphics/drawable/Drawable` | ` https://developer.android.com/reference/android/graphics/drawable/Drawable.ConstantState#newDrawable(android.content.res.Resources)(https://developer.android.com/reference/android/content/res/Resources res) ` Creates a new Drawable instance from its constant state using the specified resources. |
| ` abstract https://developer.android.com/reference/android/graphics/drawable/Drawable` | ` https://developer.android.com/reference/android/graphics/drawable/Drawable.ConstantState#newDrawable()() ` Creates a new Drawable instance from its constant state. |
| ` https://developer.android.com/reference/android/graphics/drawable/Drawable` | ` https://developer.android.com/reference/android/graphics/drawable/Drawable.ConstantState#newDrawable(android.content.res.Resources,%20android.content.res.Resources.Theme)(https://developer.android.com/reference/android/content/res/Resources res, https://developer.android.com/reference/android/content/res/Resources.Theme theme) ` Creates a new Drawable instance from its constant state using the specified resources and theme. |

| ### 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*. | ||

## Public constructors

### ConstantState

```
public ConstantState ()
```

<br />

<br />

## Public methods

### canApplyTheme

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

```
public boolean canApplyTheme ()
```

Return whether this constant state can have a theme applied.

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

### getChangingConfigurations

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

```
public abstract int getChangingConfigurations ()
```

Return a bit mask of configuration changes that will impact
this drawable (and thus require completely reloading it).

<br />

| Returns ||
|---|---|
| `int` | Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_MCC` - `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_MNC` - `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_LOCALE` - `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_TOUCHSCREEN` - `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_KEYBOARD` - `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_KEYBOARD_HIDDEN` - `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_NAVIGATION` - `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_ORIENTATION` - `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_SCREEN_LAYOUT` - `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_UI_MODE` - `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_SCREEN_SIZE` - `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_SMALLEST_SCREEN_SIZE` - `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_DENSITY` - `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_LAYOUT_DIRECTION` - `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_COLOR_MODE` - `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_FONT_SCALE` - `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_GRAMMATICAL_GENDER` - `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_FONT_WEIGHT_ADJUSTMENT` - `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_ASSETS_PATHS` - `https://developer.android.com/reference/android/content/pm/ActivityInfo#CONFIG_RESOURCES_UNUSED` |

### newDrawable

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

```
public Drawable newDrawable (Resources res)
```

Creates a new Drawable instance from its constant state using the
specified resources. This method should be implemented for drawables
that have density-dependent properties.


The default implementation for this method calls through to
`https://developer.android.com/reference/android/graphics/drawable/Drawable.ConstantState#newDrawable()`.

<br />

| Parameters ||
|---|---|
| `res` | `Resources`: the resources of the context in which the drawable will be displayed. This value may be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/drawable/Drawable` | a new drawable object based on this constant state. This value cannot be `null`. <br /> |

### newDrawable

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

```
public abstract Drawable newDrawable ()
```

Creates a new Drawable instance from its constant state.


**Note:** Using this method means density-dependent
properties, such as pixel dimensions or bitmap images, will not be
updated to match the density of the target display. To ensure
correct scaling, use `https://developer.android.com/reference/android/graphics/drawable/Drawable.ConstantState#newDrawable(android.content.res.Resources)` instead to
provide an appropriate Resources object.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/drawable/Drawable` | a new drawable object based on this constant state. This value cannot be `null`. <br /> |

**See also:**

- `https://developer.android.com/reference/android/graphics/drawable/Drawable.ConstantState#newDrawable(android.content.res.Resources)`

### newDrawable

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

```
public Drawable newDrawable (Resources res, 
                Resources.Theme theme)
```

Creates a new Drawable instance from its constant state using the
specified resources and theme. This method should be implemented for
drawables that have theme-dependent properties.


The default implementation for this method calls through to
`https://developer.android.com/reference/android/graphics/drawable/Drawable.ConstantState#newDrawable(android.content.res.Resources)`.

<br />

| Parameters ||
|---|---|
| `res` | `Resources`: the resources of the context in which the drawable will be displayed. This value may be `null`. <br /> |
| `theme` | `Resources.Theme`: the theme of the context in which the drawable will be displayed. This value may be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/graphics/drawable/Drawable` | a new drawable object based on this constant state. This value cannot be `null`. <br /> |