Android 12 Developer Preview is here! Try it out, and give us your feedback!

IconCompat

open class IconCompat : CustomVersionedParcelable
androidx.core.graphics.drawable.IconCompat

Helper for accessing features in android.graphics.drawable.Icon.

Summary

Constants
static Int

An icon that was created using createWithAdaptiveBitmap.

static Int

An icon that was created using createWithBitmap(Bitmap).

static Int

An icon that was created using createWithData(byte[], int, int).

static Int

An icon that was created using #createWithResource.

static Int

Value returned when the type of an Icon cannot be determined.

static Int

An icon that was created using #createWithContentUri.

static Int

An icon that was created using #createWithAdaptiveBitmapContentUri.

Public methods
open static IconCompat?
createFromBundle(@NonNull bundle: Bundle)

Extracts an icon from a bundle that was added using toBundle().

open static IconCompat?
createFromIcon(@NonNull context: Context, @NonNull icon: Icon)

Creates an IconCompat from an Icon.

open static IconCompat!

Create an Icon pointing to a bitmap in memory that follows the icon design guideline defined by android.graphics.drawable.AdaptiveIconDrawable.

open static IconCompat

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

open static IconCompat

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

open static IconCompat!

Create an Icon pointing to a bitmap in memory.

open static IconCompat!

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

open static IconCompat!

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

open static IconCompat!
createWithData(data: ByteArray!, offset: Int, length: Int)

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

open static IconCompat!
createWithResource(context: Context!, @DrawableRes resId: Int)

Create an Icon pointing to a drawable resource.

open Int

Gets the resource id used to create this icon.

open String

Gets the package used to create this icon.

open Int

Gets the type of the icon provided.

open Uri

Gets the uri used to create this icon.

open Drawable?
loadDrawable(@NonNull context: Context)

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

open Unit

open Unit

open IconCompat!
setTint(@ColorInt tint: Int)

Store a color to use whenever this Icon is drawn.

open IconCompat!

Store a color to use whenever this Icon is drawn.

open IconCompat!
setTintMode(mode: Mode!)

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

open Bundle

Adds this Icon to a Bundle that can be read back with the same parameters to createFromBundle(Bundle).

open Icon

open Icon
toIcon(@Nullable context: Context?)

Convert this compat object to Icon object.

open String

Constants

TYPE_ADAPTIVE_BITMAP

static val TYPE_ADAPTIVE_BITMAP: Int

An icon that was created using createWithAdaptiveBitmap.

Value: Icon.TYPE_ADAPTIVE_BITMAP

TYPE_BITMAP

static val TYPE_BITMAP: Int

An icon that was created using createWithBitmap(Bitmap).

Value: Icon.TYPE_BITMAP

TYPE_DATA