# AppCompatResources

Artifact: [androidx.appcompat:appcompat-resources](https://developer.android.com/jetpack/androidx/releases/appcompat) [View Source](https://cs.android.com/search?q=file:androidx/appcompat/content/res/AppCompatResources.java+class:androidx.appcompat.content.res.AppCompatResources) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/appcompat#1.1.0)

*** ** * ** ***


```
class AppCompatResources
```

<br />

*** ** * ** ***

Class for accessing an application's resources through AppCompat, and thus any backward compatible functionality.

## Summary

| ### Public functions |
|---|---|
| `java-static https://developer.android.com/reference/android/content/res/ColorStateList.html!` | `https://developer.android.com/reference/kotlin/androidx/appcompat/content/res/AppCompatResources#getColorStateList(android.content.Context,int)(context: https://developer.android.com/reference/android/content/Context.html, resId: @https://developer.android.com/reference/kotlin/androidx/annotation/ColorRes https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns the `https://developer.android.com/reference/android/content/res/ColorStateList.html` from the given resource. |
| `java-static https://developer.android.com/reference/android/graphics/drawable/Drawable.html?` | `https://developer.android.com/reference/kotlin/androidx/appcompat/content/res/AppCompatResources#getDrawable(android.content.Context,int)(context: https://developer.android.com/reference/android/content/Context.html, resId: @https://developer.android.com/reference/kotlin/androidx/annotation/DrawableRes https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Return a drawable object associated with a particular resource ID. |

## Public functions

### getColorStateList

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

```
java-static fun getColorStateList(context: Context, resId: @ColorRes Int): ColorStateList!
```

Returns the `https://developer.android.com/reference/android/content/res/ColorStateList.html` from the given resource. The resource can include themeable attributes, regardless of API level.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html` | context to inflate against |
| `resId: @https://developer.android.com/reference/kotlin/androidx/annotation/ColorRes https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | the resource identifier of the ColorStateList to retrieve |

### getDrawable

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

```
java-static fun getDrawable(context: Context, resId: @DrawableRes Int): Drawable?
```

Return a drawable object associated with a particular resource ID.

This method supports inflation of `<vector>`, `<animated-vector>` and `<animated-selector>` resources on devices where platform support is not available.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html` | context to inflate against |
| `resId: @https://developer.android.com/reference/kotlin/androidx/annotation/DrawableRes https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | The desired resource identifier, as generated by the aapt tool. This integer encodes the package, type, and resource entry. The value 0 is an invalid identifier. |

| Returns |
|---|---|
| `https://developer.android.com/reference/android/graphics/drawable/Drawable.html?` | Drawable An object that can be used to draw this resource. |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/content/ContextCompat#getDrawable(android.content.Context,int)` |   |