Added in API level 28

SliceItem

class SliceItem : Parcelable
kotlin.Any
   ↳ android.app.slice.SliceItem

A SliceItem is a single unit in the tree structure of a Slice. A SliceItem a piece of content and some hints about what that content means or how it should be displayed. The types of content can be:

  • FORMAT_SLICE
  • FORMAT_TEXT
  • FORMAT_IMAGE
  • FORMAT_ACTION
  • FORMAT_INT
  • FORMAT_LONG
  • FORMAT_REMOTE_INPUT
  • FORMAT_BUNDLE
  • The hints that a SliceItem are a set of strings which annotate the content. The hints that are guaranteed to be understood by the system are defined on Slice.

    Summary

    Constants
    static String

    A SliceItem that contains a PendingIntent Note: Actions contain 2 pieces of data, In addition to the pending intent, the item contains a Slice that the action applies to.

    static String

    A SliceItem that contains a Bundle.

    static String

    A SliceItem that contains an Icon

    static String

    A SliceItem that contains an int.

    static String

    A SliceItem that contains a long.

    static String

    A SliceItem that contains a RemoteInput.

    static String

    A SliceItem that contains a Slice

    static String

    A SliceItem that contains a CharSequence

    Inherited constants
    Public methods
    Int

    PendingIntent!

    Bundle!

    String!

    Get the format of this SliceItem.

    MutableList<String!>

    Gets all hints associated with this SliceItem.

    Icon!

    Int

    Long

    RemoteInput!

    Slice!

    String!

    Get the sub-type of this SliceItem.

    CharSequence!

    Boolean
    hasHint(hint: String!)

    Unit
    writeToParcel(dest: Parcel, flags: Int)

    Properties
    static Parcelable.Creator<SliceItem!>

    Constants

    FORMAT_ACTION

    Added in API level 28
    static val FORMAT_ACTION: String

    A SliceItem that contains a PendingIntent Note: Actions contain 2 pieces of data, In addition to the pending intent, the item contains a Slice that the action applies to.

    Value: "action"

    FORMAT_BUNDLE

    Added in API level 28
    static val FORMAT_BUNDLE: String

    A SliceItem that contains a Bundle.

    Value: "bundle"

    FORMAT_IMAGE

    Added in API level 28
    static val FORMAT_IMAGE: String

    A SliceItem that contains an Icon

    Value: "image"

    FORMAT_INT

    Added in API level 28
    static val FORMAT_INT: String

    A SliceItem that contains an int.

    Value: "int"

    FORMAT_LONG

    Added in API level 28
    static val FORMAT_LONG: String

    A SliceItem that contains a long.

    Value: "long"

    FORMAT_REMOTE_INPUT

    Added in API level 28
    static val FORMAT_REMOTE_INPUT: String

    A SliceItem that contains a RemoteInput.

    Value: "input"

    FORMAT_SLICE

    Added in API level 28
    static val FORMAT_SLICE: String

    A SliceItem that contains a Slice

    Value: "slice"

    FORMAT_TEXT

    Added in API level 28
    static val FORMAT_TEXT: String

    A SliceItem that contains a CharSequence

    Value: "text"

    Public methods

    describeContents

    Added in API level 28
    fun describeContents(): Int
    Return
    Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR

    getAction

    Added in API level 28
    fun getAction(): PendingIntent!
    Return
    PendingIntent! The pending intent held by this FORMAT_ACTION SliceItem

    getBundle

    Added in API level 28
    fun getBundle(): Bundle!
    Return
    Bundle! The parcelable held by this FORMAT_BUNDLE SliceItem

    getFormat

    Added in API level 28
    fun getFormat(): String!

    Get the format of this SliceItem.

    The format will be one of the following types supported by the platform:

  • FORMAT_SLICE
  • FORMAT_TEXT
  • FORMAT_IMAGE
  • FORMAT_ACTION
  • FORMAT_INT
  • FORMAT_LONG
  • FORMAT_REMOTE_INPUT
  • FORMAT_BUNDLE
  • See Also

    getIcon

    Added in API level 28
    fun getIcon(): Icon!
    Return
    Icon! The icon held by this FORMAT_IMAGE SliceItem

    getInt

    Added in API level 28
    fun getInt(): Int
    Return
    Int The color held by this FORMAT_INT SliceItem

    getLong

    Added in API level 28
    fun getLong(): Long
    Return
    Long The long held by this FORMAT_LONG SliceItem

    getRemoteInput

    Added in API level 28
    fun getRemoteInput(): RemoteInput!
    Return
    RemoteInput! The remote input held by this FORMAT_REMOTE_INPUT SliceItem

    getSlice

    Added in API level 28
    fun getSlice(): Slice!
    Return
    Slice! The slice held by this FORMAT_ACTION or FORMAT_SLICE SliceItem

    getSubType

    Added in API level 28
    fun getSubType(): String!

    Get the sub-type of this SliceItem.

    Subtypes provide additional information about the type of this information beyond basic interpretations inferred by getFormat(). For example a slice may contain many FORMAT_TEXT items, but only some of them may be Slice#SUBTYPE_MESSAGE.

    See Also

    getText

    Added in API level 28
    fun getText(): CharSequence!
    Return
    CharSequence! The text held by this FORMAT_TEXT SliceItem

    writeToParcel

    Added in API level 28
    fun writeToParcel(
        dest: Parcel,
        flags: Int
    ): Unit
    Parameters
    dest Parcel: The Parcel in which the object should be written. This value cannot be null.
    flags Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES

    Properties

    CREATOR

    Added in API level 28
    static val CREATOR: Parcelable.Creator<SliceItem!>