SliceItem

public final class SliceItem
extends Object implements VersionedParcelable

java.lang.Object
   ↳ 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:

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

static ParcelableSpan createSensitiveSpan()

Creates a span object that identifies content that should be redacted when acquired using getRedactedText().

void fireAction(Context context, Intent i)

Trigger the action on this SliceItem.

PendingIntent getAction()
String getFormat()

Get the format of this SliceItem.

List<String> getHints()

Gets all hints associated with this SliceItem.

IconCompat getIcon()
int getInt()
long getLong()
CharSequence getRedactedText()

Get the same content as getText() except with content that should be excluded from persistent logs because it was tagged with createSensitiveSpan().

Slice getSlice()
String getSubType()

Get the sub-type of this SliceItem.

CharSequence getText()
boolean hasHint(String hint)
void onPostParceling()

Called immediately after this object has been deserialized, can be used to handle any custom fields that cannot be easily annotated.

void onPreParceling(boolean isStream)

Called immediately before this object is going to be serialized, can be used to handle any custom fields that cannot be easily annotated.

String toString()

Inherited methods

Public methods

createSensitiveSpan

public static ParcelableSpan createSensitiveSpan ()

Creates a span object that identifies content that should be redacted when acquired using getRedactedText().

Returns
ParcelableSpan

fireAction

public void fireAction (Context context, 
                Intent i)

Trigger the action on this SliceItem.

Parameters
context Context: The Context to use when sending the PendingIntent.

i Intent: The intent to use when sending the PendingIntent.

Throws
PendingIntent.CanceledException

getAction

public PendingIntent getAction ()

Returns
PendingIntent The pending intent held by this SliceItem.FORMAT_ACTION SliceItem

getFormat

public String getFormat ()

Get the format of this SliceItem.

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

Returns
String

See also:

getHints

public List<String> getHints ()

Gets all hints associated with this SliceItem.

Returns
List<String> Array of hints.

getIcon

public IconCompat getIcon ()

Returns
IconCompat The icon