SliceItem

open class SliceItem
kotlin.Any
   ↳ androidx.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:

  • android.app.slice.SliceItem#FORMAT_SLICE
  • android.app.slice.SliceItem#FORMAT_TEXT
  • android.app.slice.SliceItem#FORMAT_IMAGE
  • android.app.slice.SliceItem#FORMAT_ACTION
  • android.app.slice.SliceItem#FORMAT_INT
  • android.app.slice.SliceItem#FORMAT_LONG
  • 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

    Public methods
    open MutableList<String!>

    Gets all hints associated with this SliceItem.

    open IconCompat!

    open Boolean
    hasHint(hint: String!)

    open String

    open Int

    open CharSequence!

    open Long

    open String!

    Get the sub-type of this SliceItem.

    open Slice!

    open PendingIntent!

    open Long

    open String!

    Get the format of this SliceItem.

    Public methods

    getHints

    open fun getHints(): MutableList<String!>

    Gets all hints associated with this SliceItem.

    Return
    MutableList<String!>: Array of hints.

    getIcon

    open fun getIcon(): IconCompat!
    Return
    IconCompat!: The icon held by this android.app.slice.SliceItem#FORMAT_IMAGE SliceItem

    hasHint

    open fun hasHint(hint: String!): Boolean
    Parameters
    hint String!: The hint to check for
    Return
    Boolean: true if this item contains the given hint

    toString

    open fun toString(): String
    Return
    String: A string representation of this slice item.

    getInt

    open fun getInt(): Int
    Return
    Int: The color held by this android.app.slice.SliceItem#FORMAT_INT SliceItem

    getText

    open fun getText(): CharSequence!
    Return
    CharSequence!: The text held by this android.app.slice.SliceItem#FORMAT_TEXT SliceItem

    getLong

    open fun getLong(): Long
    Return
    Long: The long held by this android.app.slice.SliceItem#FORMAT_LONG SliceItem

    getSubType

    open 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 android.app.slice.SliceItem#FORMAT_TEXT items, but only some of them may be android.app.slice.Slice#SUBTYPE_MESSAGE.

    See Also

    getSlice

    open fun getSlice(): Slice!
    Return
    Slice!: The slice held by this android.app.slice.SliceItem#FORMAT_ACTION or android.app.slice.SliceItem#FORMAT_SLICE SliceItem

    getAction

    open fun getAction(): PendingIntent!
    Return
    PendingIntent!: The pending intent held by this android.app.slice.SliceItem#FORMAT_ACTION SliceItem

    getTimestamp

    open fun getTimestamp(): Long