# Icon

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/Icon#nestedclasses)\|[Constants](https://developer.android.com/reference/android/graphics/drawable/Icon#constants)\|[Inherited Constants](https://developer.android.com/reference/android/graphics/drawable/Icon#inhconstants)\|[Fields](https://developer.android.com/reference/android/graphics/drawable/Icon#lfields)\|[Methods](https://developer.android.com/reference/android/graphics/drawable/Icon#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/graphics/drawable/Icon#inhmethods)  

# Icon

*** ** * ** ***

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

`
public

final

class
Icon
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


implements

`[Parcelable](https://developer.android.com/reference/android/os/Parcelable)`


`

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

<br />

*** ** * ** ***

An umbrella container for several serializable graphics representations, including Bitmaps, compressed bitmap images (e.g. JPG or PNG), and drawable resources (including vectors).[Much ink](https://developer.android.com/training/displaying-bitmaps/index.html)has been spilled on the best way to load images, and many clients may have different needs when it comes to threading and fetching. This class is therefore focused on encapsulation rather than behavior.

## Summary

|                                                                                                                                                                                                                        ### Nested classes                                                                                                                                                                                                                        ||
|--------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` interface` | [Icon.OnDrawableLoadedListener](https://developer.android.com/reference/android/graphics/drawable/Icon.OnDrawableLoadedListener) Implement this interface to receive a callback when[loadDrawableAsync](https://developer.android.com/reference/android/graphics/drawable/Icon#loadDrawableAsync(android.content.Context,%20android.graphics.drawable.Icon.OnDrawableLoadedListener,%20android.os.Handler))is finished and your Drawable is ready. |

|                                                                                                                                                                                                        ### Constants                                                                                                                                                                                                        ||
|-------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | [TYPE_ADAPTIVE_BITMAP](https://developer.android.com/reference/android/graphics/drawable/Icon#TYPE_ADAPTIVE_BITMAP) An icon that was created using[Icon.createWithAdaptiveBitmap](https://developer.android.com/reference/android/graphics/drawable/Icon#createWithAdaptiveBitmap(android.graphics.Bitmap)).                                                                                                         |
| `int` | [TYPE_BITMAP](https://developer.android.com/reference/android/graphics/drawable/Icon#TYPE_BITMAP) An icon that was created using[Icon.createWithBitmap(Bitmap)](https://developer.android.com/reference/android/graphics/drawable/Icon#createWithBitmap(android.graphics.Bitmap)).                                                                                                                                   |
| `int` | [TYPE_DATA](https://developer.android.com/reference/android/graphics/drawable/Icon#TYPE_DATA) An icon that was created using[Icon.createWithData(byte[], int, int)](https://developer.android.com/reference/android/graphics/drawable/Icon#createWithData(byte[],%20int,%20int)).                                                                                                                                    |
| `int` | [TYPE_RESOURCE](https://developer.android.com/reference/android/graphics/drawable/Icon#TYPE_RESOURCE) An icon that was created using[Icon.createWithResource](https://developer.android.com/reference/android/graphics/drawable/Icon#createWithResource(android.content.Context,%20int)).                                                                                                                            |
| `int` | [TYPE_URI](https://developer.android.com/reference/android/graphics/drawable/Icon#TYPE_URI) An icon that was created using[Icon.createWithContentUri](https://developer.android.com/reference/android/graphics/drawable/Icon#createWithContentUri(android.net.Uri))or[Icon.createWithFilePath(String)](https://developer.android.com/reference/android/graphics/drawable/Icon#createWithFilePath(java.lang.String)). |
| `int` | [TYPE_URI_ADAPTIVE_BITMAP](https://developer.android.com/reference/android/graphics/drawable/Icon#TYPE_URI_ADAPTIVE_BITMAP) An icon that was created using[Icon.createWithAdaptiveBitmapContentUri](https://developer.android.com/reference/android/graphics/drawable/Icon#createWithAdaptiveBitmapContentUri(android.net.Uri)).                                                                                     |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                ### Inherited constants                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From interface[android.os.Parcelable](https://developer.android.com/reference/android/os/Parcelable) |-------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `int` | [CONTENTS_FILE_DESCRIPTOR](https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR) Descriptor bit used with[describeContents()](https://developer.android.com/reference/android/os/Parcelable#describeContents()): indicates that the Parcelable object's flattened representation includes a file descriptor.                                                                                                                                            | | `int` | [PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE) Flag for use with[writeToParcel(Parcel, int)](https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)): the object being written is a return value, that is the result of a function such as "`Parcelable someFunction()`", "`void someFunction(out Parcelable)`", or "`void someFunction(inout Parcelable)`". | |

|                                                                                                                                          ### Fields                                                                                                                                           ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------|
| ` public static final `[Creator](https://developer.android.com/reference/android/os/Parcelable.Creator)`<`[Icon](https://developer.android.com/reference/android/graphics/drawable/Icon)`>` | [CREATOR](https://developer.android.com/reference/android/graphics/drawable/Icon#CREATOR) <br /> |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 ### Public methods                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  ||
|-------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` static `[Icon](https://developer.android.com/reference/android/graphics/drawable/Icon)  | ` `[createWithAdaptiveBitmap](https://developer.android.com/reference/android/graphics/drawable/Icon#createWithAdaptiveBitmap(android.graphics.Bitmap))`(`[Bitmap](https://developer.android.com/reference/android/graphics/Bitmap)` bits) ` Create an Icon pointing to a bitmap in memory that follows the icon design guideline defined by[AdaptiveIconDrawable](https://developer.android.com/reference/android/graphics/drawable/AdaptiveIconDrawable).                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ` static `[Icon](https://developer.android.com/reference/android/graphics/drawable/Icon)  | ` `[createWithAdaptiveBitmapContentUri](https://developer.android.com/reference/android/graphics/drawable/Icon#createWithAdaptiveBitmapContentUri(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` uri) ` Create an Icon pointing to an image file specified by URI.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| ` static `[Icon](https://developer.android.com/reference/android/graphics/drawable/Icon)  | ` `[createWithAdaptiveBitmapContentUri](https://developer.android.com/reference/android/graphics/drawable/Icon#createWithAdaptiveBitmapContentUri(android.net.Uri))`(`[Uri](https://developer.android.com/reference/android/net/Uri)` uri) ` Create an Icon pointing to an image file specified by URI.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ` static `[Icon](https://developer.android.com/reference/android/graphics/drawable/Icon)  | ` `[createWithBitmap](https://developer.android.com/reference/android/graphics/drawable/Icon#createWithBitmap(android.graphics.Bitmap))`(`[Bitmap](https://developer.android.com/reference/android/graphics/Bitmap)` bits) ` Create an Icon pointing to a bitmap in memory.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ` static `[Icon](https://developer.android.com/reference/android/graphics/drawable/Icon)  | ` `[createWithContentUri](https://developer.android.com/reference/android/graphics/drawable/Icon#createWithContentUri(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` uri) ` Create an Icon pointing to an image file specified by URI.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ` static `[Icon](https://developer.android.com/reference/android/graphics/drawable/Icon)  | ` `[createWithContentUri](https://developer.android.com/reference/android/graphics/drawable/Icon#createWithContentUri(android.net.Uri))`(`[Uri](https://developer.android.com/reference/android/net/Uri)` uri) ` Create an Icon pointing to an image file specified by URI.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| ` static `[Icon](https://developer.android.com/reference/android/graphics/drawable/Icon)  | ` `[createWithData](https://developer.android.com/reference/android/graphics/drawable/Icon#createWithData(byte[],%20int,%20int))`(byte[] data, int offset, int length) ` Create an Icon pointing to a compressed bitmap stored in a byte array.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ` static `[Icon](https://developer.android.com/reference/android/graphics/drawable/Icon)  | ` `[createWithFilePath](https://developer.android.com/reference/android/graphics/drawable/Icon#createWithFilePath(java.lang.String))`(`[String](https://developer.android.com/reference/java/lang/String)` path) ` Create an Icon pointing to an image file specified by path.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ` static `[Icon](https://developer.android.com/reference/android/graphics/drawable/Icon)  | ` `[createWithResource](https://developer.android.com/reference/android/graphics/drawable/Icon#createWithResource(java.lang.String,%20int))`(`[String](https://developer.android.com/reference/java/lang/String)` resPackage, int resId) ` Create an Icon pointing to a drawable resource.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ` static `[Icon](https://developer.android.com/reference/android/graphics/drawable/Icon)  | ` `[createWithResource](https://developer.android.com/reference/android/graphics/drawable/Icon#createWithResource(android.content.Context,%20int))`(`[Context](https://developer.android.com/reference/android/content/Context)` context, int resId) ` Create an Icon pointing to a drawable resource.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ` int`                                                                                    | ` `[describeContents](https://developer.android.com/reference/android/graphics/drawable/Icon#describeContents())`() ` Parcelable interface                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ` int`                                                                                    | ` `[getResId](https://developer.android.com/reference/android/graphics/drawable/Icon#getResId())`() ` Gets the resource used to create this icon.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| ` `[String](https://developer.android.com/reference/java/lang/String)                     | ` `[getResPackage](https://developer.android.com/reference/android/graphics/drawable/Icon#getResPackage())`() ` Gets the package used to create this icon.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| ` int`                                                                                    | ` `[getType](https://developer.android.com/reference/android/graphics/drawable/Icon#getType())`() ` Gets the type of the icon provided.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ` `[Uri](https://developer.android.com/reference/android/net/Uri)                         | ` `[getUri](https://developer.android.com/reference/android/graphics/drawable/Icon#getUri())`() ` Gets the uri used to create this icon.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| ` `[Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable) | ` `[loadDrawable](https://developer.android.com/reference/android/graphics/drawable/Icon#loadDrawable(android.content.Context))`(`[Context](https://developer.android.com/reference/android/content/Context)` context) ` Returns a Drawable that can be used to draw the image inside this Icon, constructing it if necessary.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ` void`                                                                                   | ` `[loadDrawableAsync](https://developer.android.com/reference/android/graphics/drawable/Icon#loadDrawableAsync(android.content.Context,%20android.os.Message))`(`[Context](https://developer.android.com/reference/android/content/Context)` context, `[Message](https://developer.android.com/reference/android/os/Message)` andThen) ` Invokes[loadDrawable(android.content.Context)](https://developer.android.com/reference/android/graphics/drawable/Icon#loadDrawable(android.content.Context))on the given[Handler](https://developer.android.com/reference/android/os/Handler)and then sends`andThen`to the same Handler when finished.                                                                                                                                                                                                                                                                                                         |
| ` void`                                                                                   | ` `[loadDrawableAsync](https://developer.android.com/reference/android/graphics/drawable/Icon#loadDrawableAsync(android.content.Context,%20android.graphics.drawable.Icon.OnDrawableLoadedListener,%20android.os.Handler))`(`[Context](https://developer.android.com/reference/android/content/Context)` context, `[Icon.OnDrawableLoadedListener](https://developer.android.com/reference/android/graphics/drawable/Icon.OnDrawableLoadedListener)` listener, `[Handler](https://developer.android.com/reference/android/os/Handler)` handler) ` Invokes[loadDrawable(android.content.Context)](https://developer.android.com/reference/android/graphics/drawable/Icon#loadDrawable(android.content.Context))on a background thread and notifies the` `[listener](https://developer.android.com/reference/android/graphics/drawable/Icon.OnDrawableLoadedListener#onDrawableLoaded(android.graphics.drawable.Drawable))` `on the`handler`when finished. |
| ` `[Icon](https://developer.android.com/reference/android/graphics/drawable/Icon)         | ` `[setTint](https://developer.android.com/reference/android/graphics/drawable/Icon#setTint(int))`(int tint) ` Store a color to use whenever this Icon is drawn.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| ` `[Icon](https://developer.android.com/reference/android/graphics/drawable/Icon)         | ` `[setTintBlendMode](https://developer.android.com/reference/android/graphics/drawable/Icon#setTintBlendMode(android.graphics.BlendMode))`(`[BlendMode](https://developer.android.com/reference/android/graphics/BlendMode)` mode) ` Store a blending mode to use whenever this Icon is drawn.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| ` `[Icon](https://developer.android.com/reference/android/graphics/drawable/Icon)         | ` `[setTintList](https://developer.android.com/reference/android/graphics/drawable/Icon#setTintList(android.content.res.ColorStateList))`(`[ColorStateList](https://developer.android.com/reference/android/content/res/ColorStateList)` tintList) ` Store a color to use whenever this Icon is drawn.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ` `[Icon](https://developer.android.com/reference/android/graphics/drawable/Icon)         | ` `[setTintMode](https://developer.android.com/reference/android/graphics/drawable/Icon#setTintMode(android.graphics.PorterDuff.Mode))`(`[PorterDuff.Mode](https://developer.android.com/reference/android/graphics/PorterDuff.Mode)` mode) ` Store a blending mode to use whenever this Icon is drawn.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| ` `[String](https://developer.android.com/reference/java/lang/String)                     | ` `[toString](https://developer.android.com/reference/android/graphics/drawable/Icon#toString())`() ` Returns a string representation of the object.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| ` void`                                                                                   | ` `[writeToParcel](https://developer.android.com/reference/android/graphics/drawable/Icon#writeToParcel(android.os.Parcel,%20int))`(`[Parcel](https://developer.android.com/reference/android/os/Parcel)` dest, int flags) ` Flatten this object in to a Parcel.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](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 `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](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`                                                                  | ` `[wait](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`                                                                  | ` `[wait](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*.                                                                                             | ||
| From interface` `[android.os.Parcelable](https://developer.android.com/reference/android/os/Parcelable)` ` |------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract int`  | ` `[describeContents](https://developer.android.com/reference/android/os/Parcelable#describeContents())`() ` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.                                    | | ` abstract void` | ` `[writeToParcel](https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int))`(`[Parcel](https://developer.android.com/reference/android/os/Parcel)` dest, int flags) ` Flatten this object in to a Parcel. | ||

## Constants

### TYPE_ADAPTIVE_BITMAP

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

```
public static final int TYPE_ADAPTIVE_BITMAP
```

An icon that was created using[Icon.createWithAdaptiveBitmap](https://developer.android.com/reference/android/graphics/drawable/Icon#createWithAdaptiveBitmap(android.graphics.Bitmap)).

<br />

**See also:**

- [getType()](https://developer.android.com/reference/android/graphics/drawable/Icon#getType())

Constant Value: 5 (0x00000005)  

### TYPE_BITMAP

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

```
public static final int TYPE_BITMAP
```

An icon that was created using[Icon.createWithBitmap(Bitmap)](https://developer.android.com/reference/android/graphics/drawable/Icon#createWithBitmap(android.graphics.Bitmap)).

<br />

**See also:**

- [getType()](https://developer.android.com/reference/android/graphics/drawable/Icon#getType())

Constant Value: 1 (0x00000001)  

### TYPE_DATA

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

```
public static final int TYPE_DATA
```

An icon that was created using[Icon.createWithData(byte[], int, int)](https://developer.android.com/reference/android/graphics/drawable/Icon#createWithData(byte[],%20int,%20int)).

<br />

**See also:**

- [getType()](https://developer.android.com/reference/android/graphics/drawable/Icon#getType())

Constant Value: 3 (0x00000003)  

### TYPE_RESOURCE

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

```
public static final int TYPE_RESOURCE
```

An icon that was created using[Icon.createWithResource](https://developer.android.com/reference/android/graphics/drawable/Icon#createWithResource(android.content.Context,%20int)).

<br />

**See also:**

- [getType()](https://developer.android.com/reference/android/graphics/drawable/Icon#getType())

Constant Value: 2 (0x00000002)  

### TYPE_URI

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

```
public static final int TYPE_URI
```

An icon that was created using[Icon.createWithContentUri](https://developer.android.com/reference/android/graphics/drawable/Icon#createWithContentUri(android.net.Uri))or[Icon.createWithFilePath(String)](https://developer.android.com/reference/android/graphics/drawable/Icon#createWithFilePath(java.lang.String)).

<br />

**See also:**

- [getType()](https://developer.android.com/reference/android/graphics/drawable/Icon#getType())

Constant Value: 4 (0x00000004)  

### TYPE_URI_ADAPTIVE_BITMAP

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

```
public static final int TYPE_URI_ADAPTIVE_BITMAP
```

An icon that was created using[Icon.createWithAdaptiveBitmapContentUri](https://developer.android.com/reference/android/graphics/drawable/Icon#createWithAdaptiveBitmapContentUri(android.net.Uri)).

<br />

**See also:**

- [getType()](https://developer.android.com/reference/android/graphics/drawable/Icon#getType())

Constant Value: 6 (0x00000006)

## Fields

### CREATOR

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

```
public static final Creator<Icon> CREATOR
```

<br />

<br />

## Public methods

### createWithAdaptiveBitmap

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

```
public static Icon createWithAdaptiveBitmap (Bitmap bits)
```

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

<br />

|                                                   Parameters                                                    ||
|--------|---------------------------------------------------------------------------------------------------------|
| `bits` | `Bitmap`: A valid[Bitmap](https://developer.android.com/reference/android/graphics/Bitmap)object <br /> |

|                                                      Returns                                                       ||
|--------------------------------------------------------------------------------|------------------------------------|
| [Icon](https://developer.android.com/reference/android/graphics/drawable/Icon) | This value cannot be`null`. <br /> |

### createWithAdaptiveBitmapContentUri

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

```
public static Icon createWithAdaptiveBitmapContentUri (String uri)
```

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

<br />

|                                                   Parameters                                                   ||
|-------|---------------------------------------------------------------------------------------------------------|
| `uri` | `String`: A uri referring to local content:// or file:// image data. This value cannot be`null`. <br /> |

|                                                      Returns                                                       ||
|--------------------------------------------------------------------------------|------------------------------------|
| [Icon](https://developer.android.com/reference/android/graphics/drawable/Icon) | This value cannot be`null`. <br /> |

### createWithAdaptiveBitmapContentUri

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

```
public static Icon createWithAdaptiveBitmapContentUri (Uri uri)
```

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

<br />

|                                                 Parameters                                                  ||
|-------|------------------------------------------------------------------------------------------------------|
| `uri` | `Uri`: A uri referring to local content:// or file:// image data. This value cannot be`null`. <br /> |

|                                                      Returns                                                       ||
|--------------------------------------------------------------------------------|------------------------------------|
| [Icon](https://developer.android.com/reference/android/graphics/drawable/Icon) | This value cannot be`null`. <br /> |

### createWithBitmap

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

```
public static Icon createWithBitmap (Bitmap bits)
```

Create an Icon pointing to a bitmap in memory.

<br />

|                                                   Parameters                                                    ||
|--------|---------------------------------------------------------------------------------------------------------|
| `bits` | `Bitmap`: A valid[Bitmap](https://developer.android.com/reference/android/graphics/Bitmap)object <br /> |

|                                                      Returns                                                       ||
|--------------------------------------------------------------------------------|------------------------------------|
| [Icon](https://developer.android.com/reference/android/graphics/drawable/Icon) | This value cannot be`null`. <br /> |

### createWithContentUri

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

```
public static Icon createWithContentUri (String uri)
```

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

<br />

|                                     Parameters                                     ||
|-------|-----------------------------------------------------------------------------|
| `uri` | `String`: A uri referring to local content:// or file:// image data. <br /> |

|                                                      Returns                                                       ||
|--------------------------------------------------------------------------------|------------------------------------|
| [Icon](https://developer.android.com/reference/android/graphics/drawable/Icon) | This value cannot be`null`. <br /> |

### createWithContentUri

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

```
public static Icon createWithContentUri (Uri uri)
```

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

<br />

|                                   Parameters                                    ||
|-------|--------------------------------------------------------------------------|
| `uri` | `Uri`: A uri referring to local content:// or file:// image data. <br /> |

|                                                      Returns                                                       ||
|--------------------------------------------------------------------------------|------------------------------------|
| [Icon](https://developer.android.com/reference/android/graphics/drawable/Icon) | This value cannot be`null`. <br /> |

### createWithData

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

```
public static Icon createWithData (byte[] data, 
                int offset, 
                int length)
```

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

<br />

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

|                                                      Returns                                                       ||
|--------------------------------------------------------------------------------|------------------------------------|
| [Icon](https://developer.android.com/reference/android/graphics/drawable/Icon) | This value cannot be`null`. <br /> |

### createWithFilePath

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

```
public static Icon createWithFilePath (String path)
```

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

<br />

|                                                                                           Parameters                                                                                            ||
|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `path` | `String`: A path to a file that contains compressed bitmap data of a type that[BitmapFactory](https://developer.android.com/reference/android/graphics/BitmapFactory)can decode. <br /> |

|                                                      Returns                                                       ||
|--------------------------------------------------------------------------------|------------------------------------|
| [Icon](https://developer.android.com/reference/android/graphics/drawable/Icon) | This value cannot be`null`. <br /> |

### createWithResource

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

```
public static Icon createWithResource (String resPackage, 
                int resId)
```

Create an Icon pointing to a drawable resource.

<br />

|                                       Parameters                                       ||
|--------------|--------------------------------------------------------------------------|
| `resPackage` | `String`: Name of the package containing the resource in question <br /> |
| `resId`      | `int`: ID of the drawable resource <br />                                |

|                                                      Returns                                                       ||
|--------------------------------------------------------------------------------|------------------------------------|
| [Icon](https://developer.android.com/reference/android/graphics/drawable/Icon) | This value cannot be`null`. <br /> |

### createWithResource

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

```
public static Icon createWithResource (Context context, 
                int resId)
```

Create an Icon pointing to a drawable resource.

<br />

|                                                          Parameters                                                           ||
|-----------|--------------------------------------------------------------------------------------------------------------------|
| `context` | `Context`: The context for the application whose resources should be used to resolve the given resource ID. <br /> |
| `resId`   | `int`: ID of the drawable resource <br />                                                                          |

|                                                      Returns                                                       ||
|--------------------------------------------------------------------------------|------------------------------------|
| [Icon](https://developer.android.com/reference/android/graphics/drawable/Icon) | This value cannot be`null`. <br /> |

### describeContents

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

```
public int describeContents ()
```

Parcelable interface

<br />

|                                                                                                                         Returns                                                                                                                         ||
|-------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either`0`or[CONTENTS_FILE_DESCRIPTOR](https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR) <br /> |

### getResId

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

```
public int getResId ()
```

Gets the resource used to create this icon.

Only valid for icons of type[TYPE_RESOURCE](https://developer.android.com/reference/android/graphics/drawable/Icon#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.

<br />

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

### getResPackage

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

```
public String getResPackage ()
```

Gets the package used to create this icon.

Only valid for icons of type[TYPE_RESOURCE](https://developer.android.com/reference/android/graphics/drawable/Icon#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.

<br />

|                                                Returns                                                 ||
|--------------------------------------------------------------------|------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | This value cannot be`null`. <br /> |

### getType

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

```
public int getType ()
```

Gets the type of the icon provided.

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

<br />

|                                                                                                                                                                                                                                                                                                                                  Returns                                                                                                                                                                                                                                                                                                                                   ||
|-------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | Value is[TYPE_BITMAP](https://developer.android.com/reference/android/graphics/drawable/Icon#TYPE_BITMAP),[TYPE_RESOURCE](https://developer.android.com/reference/android/graphics/drawable/Icon#TYPE_RESOURCE),[TYPE_DATA](https://developer.android.com/reference/android/graphics/drawable/Icon#TYPE_DATA),[TYPE_URI](https://developer.android.com/reference/android/graphics/drawable/Icon#TYPE_URI),[TYPE_ADAPTIVE_BITMAP](https://developer.android.com/reference/android/graphics/drawable/Icon#TYPE_ADAPTIVE_BITMAP), or[TYPE_URI_ADAPTIVE_BITMAP](https://developer.android.com/reference/android/graphics/drawable/Icon#TYPE_URI_ADAPTIVE_BITMAP) <br /> |

### getUri

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

```
public Uri getUri ()
```

Gets the uri used to create this icon.

Only valid for icons of type[TYPE_URI](https://developer.android.com/reference/android/graphics/drawable/Icon#TYPE_URI)and[TYPE_URI_ADAPTIVE_BITMAP](https://developer.android.com/reference/android/graphics/drawable/Icon#TYPE_URI_ADAPTIVE_BITMAP). 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.

<br />

|                                              Returns                                               ||
|----------------------------------------------------------------|------------------------------------|
| [Uri](https://developer.android.com/reference/android/net/Uri) | This value cannot be`null`. <br /> |

### loadDrawable

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

```
public Drawable loadDrawable (Context context)
```

Returns a Drawable that can be used to draw the image inside this Icon, constructing it if necessary. Depending on the type of image, this may not be something you want to do on the UI thread, so consider using[loadDrawableAsync](https://developer.android.com/reference/android/graphics/drawable/Icon#loadDrawableAsync(android.content.Context,%20android.os.Message))instead.

<br />

|                                                                                                                     Parameters                                                                                                                      ||
|-----------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `context` | `Context`:[Context](https://developer.android.com/reference/android/content/Context)in which to load the drawable; used to access[Resources](https://developer.android.com/reference/android/content/res/Resources), for example. <br /> |

|                                                                                        Returns                                                                                        ||
|----------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------|
| [Drawable](https://developer.android.com/reference/android/graphics/drawable/Drawable) | A fresh instance of a drawable for this image, yours to keep. This value may be`null`. <br /> |

### loadDrawableAsync

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

```
public void loadDrawableAsync (Context context, 
                Message andThen)
```

Invokes[loadDrawable(android.content.Context)](https://developer.android.com/reference/android/graphics/drawable/Icon#loadDrawable(android.content.Context))on the given[Handler](https://developer.android.com/reference/android/os/Handler)and then sends`andThen`to the same Handler when finished.

<br />

|                                                                                                                                                        Parameters                                                                                                                                                        ||
|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `context` | `Context`:[Context](https://developer.android.com/reference/android/content/Context)in which to load the drawable; see[loadDrawable(android.content.Context)](https://developer.android.com/reference/android/graphics/drawable/Icon#loadDrawable(android.content.Context))This value cannot be`null`. <br /> |
| `andThen` | `Message`:[Message](https://developer.android.com/reference/android/os/Message)to send to its target once the drawable is available. The[obj](https://developer.android.com/reference/android/os/Message#obj)property is populated with the Drawable. This value cannot be`null`. <br />                      |

### loadDrawableAsync

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

```
public void loadDrawableAsync (Context context, 
                Icon.OnDrawableLoadedListener listener, 
                Handler handler)
```

Invokes[loadDrawable(android.content.Context)](https://developer.android.com/reference/android/graphics/drawable/Icon#loadDrawable(android.content.Context))on a background thread and notifies the`
`[listener](https://developer.android.com/reference/android/graphics/drawable/Icon.OnDrawableLoadedListener#onDrawableLoaded(android.graphics.drawable.Drawable))` `on the`handler`when finished.

<br />

|                                                                                                                                                                                         Parameters                                                                                                                                                                                         ||
|------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `context`  | `Context`:[Context](https://developer.android.com/reference/android/content/Context)in which to load the drawable; see[loadDrawable(android.content.Context)](https://developer.android.com/reference/android/graphics/drawable/Icon#loadDrawable(android.content.Context))This value cannot be`null`. <br />                                                                  |
| `listener` | `Icon.OnDrawableLoadedListener`: to be[notified](https://developer.android.com/reference/android/graphics/drawable/Icon.OnDrawableLoadedListener#onDrawableLoaded(android.graphics.drawable.Drawable))when[loadDrawable(android.content.Context)](https://developer.android.com/reference/android/graphics/drawable/Icon#loadDrawable(android.content.Context))finished <br /> |
| `handler`  | `Handler`:[Handler](https://developer.android.com/reference/android/os/Handler)on which to notify the`listener` <br />                                                                                                                                                                                                                                                         |

### setTint

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

```
public Icon setTint (int tint)
```

Store a color to use whenever this Icon is drawn.

<br />

|                                                                      Parameters                                                                      ||
|--------|----------------------------------------------------------------------------------------------------------------------------------------------|
| `tint` | `int`: a color, as in[Drawable.setTint(int)](https://developer.android.com/reference/android/graphics/drawable/Drawable#setTint(int)) <br /> |

|                                                                               Returns                                                                                ||
|--------------------------------------------------------------------------------|--------------------------------------------------------------------------------------|
| [Icon](https://developer.android.com/reference/android/graphics/drawable/Icon) | this same object, for use in chained construction This value cannot be`null`. <br /> |

### setTintBlendMode

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

```
public Icon setTintBlendMode (BlendMode mode)
```

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

<br />

|                                                                                                            Parameters                                                                                                            ||
|--------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `mode` | `BlendMode`: a blending mode, as in[Drawable.setTintMode(PorterDuff.Mode)](https://developer.android.com/reference/android/graphics/drawable/Drawable#setTintMode(android.graphics.PorterDuff.Mode)), may be null <br /> |

|                                                                               Returns                                                                                ||
|--------------------------------------------------------------------------------|--------------------------------------------------------------------------------------|
| [Icon](https://developer.android.com/reference/android/graphics/drawable/Icon) | this same object, for use in chained construction This value cannot be`null`. <br /> |

### setTintList

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

```
public Icon setTintList (ColorStateList tintList)
```

Store a color to use whenever this Icon is drawn.

<br />

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

|                                                                               Returns                                                                                ||
|--------------------------------------------------------------------------------|--------------------------------------------------------------------------------------|
| [Icon](https://developer.android.com/reference/android/graphics/drawable/Icon) | this same object, for use in chained construction This value cannot be`null`. <br /> |

### setTintMode

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

```
public Icon setTintMode (PorterDuff.Mode mode)
```

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

<br />

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

|                                                                               Returns                                                                                ||
|--------------------------------------------------------------------------------|--------------------------------------------------------------------------------------|
| [Icon](https://developer.android.com/reference/android/graphics/drawable/Icon) | this same object, for use in chained construction This value cannot be`null`. <br /> |

### toString

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

```
public String toString ()
```

Returns a string representation of the object.

<br />

|                                                      Returns                                                      ||
|--------------------------------------------------------------------|-----------------------------------------------|
| [String](https://developer.android.com/reference/java/lang/String) | a string representation of the object. <br /> |

### writeToParcel

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

```
public void writeToParcel (Parcel dest, 
                int flags)
```

Flatten this object in to a Parcel.

<br />

|                                                                                                                                                                                                                               Parameters                                                                                                                                                                                                                                ||
|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `dest`  | `Parcel`: The Parcel in which the object should be written. This value cannot be`null`. <br />                                                                                                                                                                                                                                                                                                                                                                 |
| `flags` | `int`: Additional flags about how the object should be written. May be 0 or[Parcelable.PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE). Value is either`0`or a combination of[Parcelable.PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE), and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES <br /> |