# 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)

*** ** * ** ***


```
public final class AppCompatResources
```

<br />

*** ** * ** ***

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

## Summary

| ### Public methods |
|---|---|
| `static https://developer.android.com/reference/android/content/res/ColorStateList.html` | `https://developer.android.com/reference/androidx/appcompat/content/res/AppCompatResources#getColorStateList(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/ColorRes int resId)` Returns the `https://developer.android.com/reference/android/content/res/ColorStateList.html` from the given resource. |
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/graphics/drawable/Drawable.html` | `https://developer.android.com/reference/androidx/appcompat/content/res/AppCompatResources#getDrawable(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/DrawableRes int resId)` Return a drawable object associated with a particular resource ID. |

## Public methods

### getColorStateList

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

```
public static ColorStateList getColorStateList(@NonNull Context context, @ColorRes int resId)
```

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 |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context` | context to inflate against |
| `@https://developer.android.com/reference/androidx/annotation/ColorRes int resId` | 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)

```
public static @Nullable Drawable getDrawable(@NonNull Context context, @DrawableRes int resId)
```

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 |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context` | context to inflate against |
| `@https://developer.android.com/reference/androidx/annotation/DrawableRes int resId` | 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://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html 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/androidx/core/content/ContextCompat#getDrawable(android.content.Context,int)` |   |