# IconCompat

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/graphics/drawable/IconCompat.java+class:androidx.core.graphics.drawable.IconCompat) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

*** ** * ** ***

<br />

```
class IconCompat : VersionedParcelable
```

<br />

*** ** * ** ***

Helper for accessing features in `https://developer.android.com/reference/android/graphics/drawable/Icon.html`.

## Summary

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#TYPE_ADAPTIVE_BITMAP() = 5` An icon that was created using `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#createWithAdaptiveBitmap(android.graphics.Bitmap)`. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#TYPE_BITMAP() = 1` An icon that was created using `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#createWithBitmap(android.graphics.Bitmap)`. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#TYPE_DATA() = 3` An icon that was created using `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#createWithData(byte[],int,int)`. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#TYPE_RESOURCE() = 2` An icon that was created using `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#createWithResource(android.content.Context,int)`. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#TYPE_UNKNOWN() = -1` Value returned when the type of an `https://developer.android.com/reference/android/graphics/drawable/Icon.html` cannot be determined. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#TYPE_URI() = 4` An icon that was created using `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#createWithContentUri(java.lang.String)`. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#TYPE_URI_ADAPTIVE_BITMAP() = 6` An icon that was created using `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#createWithAdaptiveBitmapContentUri(java.lang.String)`. |

| ### Public functions |
|---|---|
| `java-static https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat?` | `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#createFromBundle(android.os.Bundle)(bundle: https://developer.android.com/reference/android/os/Bundle.html)` Extracts an icon from a bundle that was added using `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#toBundle()`. |
| `java-static https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat` | `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#createFromIcon(android.content.Context,android.graphics.drawable.Icon)(context: https://developer.android.com/reference/android/content/Context.html, icon: https://developer.android.com/reference/android/graphics/drawable/Icon.html)` Creates an IconCompat from an Icon. |
| `java-static https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat` | `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#createWithAdaptiveBitmap(android.graphics.Bitmap)(bits: https://developer.android.com/reference/android/graphics/Bitmap.html)` Create an Icon pointing to a bitmap in memory that follows the icon design guideline defined by `https://developer.android.com/reference/android/graphics/drawable/AdaptiveIconDrawable.html`. |
| `java-static https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat` | `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#createWithAdaptiveBitmapContentUri(java.lang.String)(uri: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Create an Icon pointing to an image file specified by URI. |
| `java-static https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat` | `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#createWithAdaptiveBitmapContentUri(android.net.Uri)(uri: https://developer.android.com/reference/android/net/Uri.html)` Create an Icon pointing to an image file specified by URI. |
| `java-static https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat` | `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#createWithBitmap(android.graphics.Bitmap)(bits: https://developer.android.com/reference/android/graphics/Bitmap.html)` Create an Icon pointing to a bitmap in memory. |
| `java-static https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat` | `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#createWithContentUri(java.lang.String)(uri: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)` Create an Icon pointing to an image file specified by URI. |
| `java-static https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat` | `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#createWithContentUri(android.net.Uri)(uri: https://developer.android.com/reference/android/net/Uri.html)` Create an Icon pointing to an image file specified by URI. |
| `java-static https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat` | `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#createWithData(byte[],int,int)(data: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>, offset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, length: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Create an Icon pointing to a compressed bitmap stored in a byte array. |
| `java-static https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat` | `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#createWithResource(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)` Create an Icon pointing to a drawable resource. |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/DrawableRes https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#getResId()()` Gets the drawable resource id used to create this icon. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#getResPackage()()` Gets the package used to create this icon. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#getType()()` Gets the type of the icon provided. |
| `https://developer.android.com/reference/android/net/Uri.html` | `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#getUri()()` Gets the uri used to create this icon. |
| `https://developer.android.com/reference/android/graphics/drawable/Drawable.html?` | `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#loadDrawable(android.content.Context)(context: https://developer.android.com/reference/android/content/Context.html)` Returns a Drawable that can be used to draw the image inside this Icon, constructing it if necessary. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#onPostParceling()()` Called immediately after this object has been deserialized, can be used to handle any custom fields that cannot be easily annotated. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#onPreParceling(boolean)(isStream: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)` Called immediately before this object is going to be serialized, can be used to handle any custom fields that cannot be easily annotated. |
| `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat` | `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#setTint(int)(tint: @https://developer.android.com/reference/kotlin/androidx/annotation/ColorInt https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Store a color to use whenever this Icon is drawn. |
| `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat` | `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#setTintList(android.content.res.ColorStateList)(tintList: https://developer.android.com/reference/android/content/res/ColorStateList.html?)` Store a color to use whenever this Icon is drawn. |
| `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat` | `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#setTintMode(android.graphics.PorterDuff.Mode)(mode: https://developer.android.com/reference/android/graphics/PorterDuff.Mode.html?)` Store a blending mode to use whenever this Icon is drawn. |
| `https://developer.android.com/reference/android/os/Bundle.html` | `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#toBundle()()` Adds this Icon to a Bundle that can be read back with the same parameters to `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#createFromBundle(android.os.Bundle)`. |
| `https://developer.android.com/reference/android/graphics/drawable/Icon.html` | `[toIcon](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#toIcon())()` **This function is deprecated.** Use `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#toIcon(android.content.Context)` to generate the `https://developer.android.com/reference/android/graphics/drawable/Icon.html` object. <br /> |
| `https://developer.android.com/reference/android/graphics/drawable/Icon.html` | `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#toIcon(android.content.Context)(context: https://developer.android.com/reference/android/content/Context.html?)` Convert this compat object to `https://developer.android.com/reference/android/graphics/drawable/Icon.html` object. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#toString()()` |

## Constants

### TYPE_ADAPTIVE_BITMAP

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

```
const val TYPE_ADAPTIVE_BITMAP = 5: Int
```

An icon that was created using `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#createWithAdaptiveBitmap(android.graphics.Bitmap)`.

### TYPE_BITMAP

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

```
const val TYPE_BITMAP = 1: Int
```

An icon that was created using `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#createWithBitmap(android.graphics.Bitmap)`.

### TYPE_DATA

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

```
const val TYPE_DATA = 3: Int
```

An icon that was created using `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#createWithData(byte[],int,int)`.

### TYPE_RESOURCE

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

```
const val TYPE_RESOURCE = 2: Int
```

An icon that was created using `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#createWithResource(android.content.Context,int)`.

### TYPE_UNKNOWN

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

```
const val TYPE_UNKNOWN = -1: Int
```

Value returned when the type of an `https://developer.android.com/reference/android/graphics/drawable/Icon.html` cannot be determined.

### TYPE_URI

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

```
const val TYPE_URI = 4: Int
```

An icon that was created using `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#createWithContentUri(java.lang.String)`.

### TYPE_URI_ADAPTIVE_BITMAP

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

```
const val TYPE_URI_ADAPTIVE_BITMAP = 6: Int
```

An icon that was created using `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#createWithAdaptiveBitmapContentUri(java.lang.String)`.

## Public functions

### createFromBundle

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

```
java-static fun createFromBundle(bundle: Bundle): IconCompat?
```

Extracts an icon from a bundle that was added using `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#toBundle()`.

### createFromIcon

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

```
java-static fun createFromIcon(context: Context, icon: Icon): IconCompat
```

Creates an IconCompat from an Icon.

### createWithAdaptiveBitmap

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

```
java-static fun createWithAdaptiveBitmap(bits: Bitmap): IconCompat
```

Create an Icon pointing to a bitmap in memory that follows the icon design guideline defined by `https://developer.android.com/reference/android/graphics/drawable/AdaptiveIconDrawable.html`.

| Parameters |
|---|---|
| `bits: https://developer.android.com/reference/android/graphics/Bitmap.html` | A valid `https://developer.android.com/reference/android/graphics/Bitmap.html` object |

| See also |
|---|---|
| `https://developer.android.com/reference/android/graphics/drawable/Icon.html#createWithAdaptiveBitmap(android.graphics.Bitmap)` |   |

### createWithAdaptiveBitmapContentUri

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

```
java-static fun createWithAdaptiveBitmapContentUri(uri: String): IconCompat
```

Create an Icon pointing to an image file specified by URI. Image file should follow the icon design guideline defined by `https://developer.android.com/reference/android/graphics/drawable/AdaptiveIconDrawable.html`.

| Parameters |
|---|---|
| `uri: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | A uri referring to local content:// or file:// image data. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/graphics/drawable/Icon.html#createWithAdaptiveBitmapContentUri(java.lang.String)` |   |

### createWithAdaptiveBitmapContentUri

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

```
java-static fun createWithAdaptiveBitmapContentUri(uri: Uri): IconCompat
```

Create an Icon pointing to an image file specified by URI. Image file should follow the icon design guideline defined by `https://developer.android.com/reference/android/graphics/drawable/AdaptiveIconDrawable.html`.

| Parameters |
|---|---|
| `uri: https://developer.android.com/reference/android/net/Uri.html` | A uri referring to local content:// or file:// image data. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/graphics/drawable/Icon.html#createWithAdaptiveBitmapContentUri(java.lang.String)` |   |

### createWithBitmap

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

```
java-static fun createWithBitmap(bits: Bitmap): IconCompat
```

Create an Icon pointing to a bitmap in memory.

| Parameters |
|---|---|
| `bits: https://developer.android.com/reference/android/graphics/Bitmap.html` | A valid `https://developer.android.com/reference/android/graphics/Bitmap.html` object |

| See also |
|---|---|
| `https://developer.android.com/reference/android/graphics/drawable/Icon.html#createWithBitmap(android.graphics.Bitmap)` |   |

### createWithContentUri

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

```
java-static fun createWithContentUri(uri: String): IconCompat
```

Create an Icon pointing to an image file specified by URI.

| Parameters |
|---|---|
| `uri: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | A uri referring to local content:// or file:// image data. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/graphics/drawable/Icon.html#createWithContentUri(java.lang.String)` |   |

### createWithContentUri

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

```
java-static fun createWithContentUri(uri: Uri): IconCompat
```

Create an Icon pointing to an image file specified by URI.

| Parameters |
|---|---|
| `uri: https://developer.android.com/reference/android/net/Uri.html` | A uri referring to local content:// or file:// image data. |

| See also |
|---|---|
| `https://developer.android.com/reference/android/graphics/drawable/Icon.html#createWithContentUri(java.lang.String)` |   |

### createWithData

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

```
java-static fun createWithData(data: ByteArray<Byte>, offset: Int, length: Int): IconCompat
```

Create an Icon pointing to a compressed bitmap stored in a byte array.

| Parameters |
|---|---|
| `data: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte/index.html>` | Byte array storing compressed bitmap data of a type that `https://developer.android.com/reference/android/graphics/BitmapFactory.html` can decode (see `https://developer.android.com/reference/android/graphics/Bitmap.CompressFormat.html`). |
| `offset: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Offset into `data` at which the bitmap data starts |
| `length: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Length of the bitmap data |

| See also |
|---|---|
| `https://developer.android.com/reference/android/graphics/drawable/Icon.html#createWithData(byte[], int, int)` |   |

### createWithResource

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

```
java-static fun createWithResource(context: Context, resId: @DrawableRes Int): IconCompat
```

Create an Icon pointing to a drawable resource.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html` | The context for the application whose resources should be used to resolve the given resource ID. |
| `resId: @https://developer.android.com/reference/kotlin/androidx/annotation/DrawableRes https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | ID of the drawable resource |

| See also |
|---|---|
| `https://developer.android.com/reference/android/graphics/drawable/Icon.html#createWithResource(android.content.Context, int)` |   |

### getResId

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

```
fun getResId(): @DrawableRes Int
```

Gets the drawable resource id used to create this icon.

Only valid for icons of type TYPE_RESOURCE. Note: This resource may not be available if the application changes at all, and it is up to the caller to ensure safety if this resource is re-used and/or persisted.

### getResPackage

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

```
fun getResPackage(): String
```

Gets the package used to create this icon.

Only valid for icons of type TYPE_RESOURCE. Note: This package may not be available if referenced in the future, and it is up to the caller to ensure safety if this package is re-used and/or persisted.

### getType

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

```
fun getType(): Int
```

Gets the type of the icon provided.

Note that new types may be added later, so callers should guard against other types being returned.

### getUri

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

```
fun getUri(): Uri
```

Gets the uri used to create this icon.

Only valid for icons of type TYPE_URI. Note: This uri may not be available in the future, and it is up to the caller to ensure safety if this uri is re-used and/or persisted.

### loadDrawable

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

```
fun loadDrawable(context: Context): Drawable?
```

Returns a Drawable that can be used to draw the image inside this Icon, constructing it if necessary.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html` | `https://developer.android.com/reference/android/content/Context.html` in which to load the drawable; used to access `https://developer.android.com/reference/android/content/res/Resources.html`, for example. |

| Returns |
|---|---|
| `https://developer.android.com/reference/android/graphics/drawable/Drawable.html?` | A fresh instance of a drawable for this image, yours to keep. |

### onPostParceling

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

```
fun onPostParceling(): Unit
```

Called immediately after this object has been deserialized, can be used to handle any custom fields that cannot be easily annotated.

### onPreParceling

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

```
fun onPreParceling(isStream: Boolean): Unit
```

Called immediately before this object is going to be serialized, can be used to handle any custom fields that cannot be easily annotated.

### setTint

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

```
fun setTint(tint: @ColorInt Int): IconCompat
```

Store a color to use whenever this Icon is drawn.

| Parameters |
|---|---|
| `tint: @https://developer.android.com/reference/kotlin/androidx/annotation/ColorInt https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | a color, as in `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#setTint(int)` |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat` | this same object, for use in chained construction |

### setTintList

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

```
fun setTintList(tintList: ColorStateList?): IconCompat
```

Store a color to use whenever this Icon is drawn.

| Parameters |
|---|---|
| `tintList: https://developer.android.com/reference/android/content/res/ColorStateList.html?` | as in `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#setTintList(android.content.res.ColorStateList)`, null to remove tint |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat` | this same object, for use in chained construction |

### setTintMode

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

```
fun setTintMode(mode: PorterDuff.Mode?): IconCompat
```

Store a blending mode to use whenever this Icon is drawn.

| Parameters |
|---|---|
| `mode: https://developer.android.com/reference/android/graphics/PorterDuff.Mode.html?` | a blending mode, as in `https://developer.android.com/reference/android/graphics/drawable/Drawable.html#setTintMode(android.graphics.PorterDuff.Mode)`, may be null |

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat` | this same object, for use in chained construction |

### toBundle

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

```
fun toBundle(): Bundle
```

Adds this Icon to a Bundle that can be read back with the same parameters to `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#createFromBundle(android.os.Bundle)`.

### toIcon

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

```
fun [toIcon](https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#toIcon())(): Icon
```

> [!CAUTION]
> **This function is deprecated.**   
>
> Use `https://developer.android.com/reference/kotlin/androidx/core/graphics/drawable/IconCompat#toIcon(android.content.Context)` to generate the `https://developer.android.com/reference/android/graphics/drawable/Icon.html` object.

### toIcon

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

```
fun toIcon(context: Context?): Icon
```

Convert this compat object to `https://developer.android.com/reference/android/graphics/drawable/Icon.html` object.

| Returns |
|---|---|
| `https://developer.android.com/reference/android/graphics/drawable/Icon.html` | `https://developer.android.com/reference/android/graphics/drawable/Icon.html` object |

### toString

```
fun toString(): String
```