lightbulb_outline Help shape the future of the Google Play Console, Android Studio, and Firebase. Start survey
added in version 26.1.0
belongs to Maven artifact com.android.support:support-compat:28.0.0-alpha1

IconCompat

public class IconCompat
extends Object

java.lang.Object
   ↳ android.support.v4.graphics.drawable.IconCompat


Helper for accessing features in Icon.

Summary

Public methods

static IconCompat createWithAdaptiveBitmap(Bitmap bits)

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

static IconCompat createWithBitmap(Bitmap bits)

Create an Icon pointing to a bitmap in memory.

static IconCompat createWithContentUri(String uri)

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

static IconCompat createWithContentUri(Uri uri)

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

static IconCompat createWithData(byte[] data, int offset, int length)

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

static IconCompat createWithResource(Context context, int resId)

Create an Icon pointing to a drawable resource.

Icon toIcon()

Convert this compat object to Icon object.

Inherited methods

From class java.lang.Object

Public methods

createWithAdaptiveBitmap

added in version 26.1.0
IconCompat createWithAdaptiveBitmap (Bitmap bits)

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

Parameters
bits Bitmap: A valid Bitmap object

Returns
IconCompat

createWithBitmap

added in version 26.1.0
IconCompat createWithBitmap (Bitmap bits)

Create an Icon pointing to a bitmap in memory.

Parameters
bits Bitmap: A valid Bitmap object

Returns
IconCompat

createWithContentUri

added in version 26.1.0
IconCompat createWithContentUri (String uri)

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

Parameters
uri String: A uri referring to local content:// or file:// image data.

Returns
IconCompat

createWithContentUri

added in version 26.1.0
IconCompat createWithContentUri (Uri uri)

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

Parameters
uri Uri: A uri referring to local content:// or file:// image data.

Returns
IconCompat

createWithData

added in version 26.1.0
IconCompat createWithData (byte[] data, 
                int offset, 
                int length)

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

Parameters
data byte: Byte array storing compressed bitmap data of a type that BitmapFactory can decode (see Bitmap.CompressFormat).

offset int: Offset into data at which the bitmap data starts

length int: Length of the bitmap data

Returns
IconCompat

createWithResource

added in version 26.1.0
IconCompat createWithResource (Context context, 
                int resId)

Create an Icon pointing to a drawable resource.

Parameters
context Context: The context for the application whose resources should be used to resolve the given resource ID.

resId int: ID of the drawable resource

Returns
IconCompat

toIcon

added in version 27.1.0
Icon toIcon ()

Convert this compat object to Icon object.

Returns
Icon Icon object