# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Nested Classes | Constants | Inherited Constants | Fields | Protected Ctors | Methods | Inherited Methods

# Slice

`public final class Slice`
`extends Object` `implements Parcelable`

java.lang.Object
↳ | android.app.slice.Slice

A slice is a piece of app content and actions that can be surfaced outside of the app.

They are constructed using `Builder` in a tree structure that provides the OS some information about how the content should be displayed.

## Summary

### Nested classes
`class` | `Slice.Builder` A Builder used to construct `Slice`s

### Constants
`String` | `EXTRA_RANGE_VALUE` Key to retrieve an extra added to an intent when the value of an input range is changed.
`String` | `EXTRA_TOGGLE_STATE` Key to retrieve an extra added to an intent when a control is changed.
`String` | `HINT_ACTIONS` Hint that this slice contains a number of actions that can be grouped together in a sort of controls area of the UI.
`String` | `HINT_ERROR` A hint to indicate that this slice represents an error.
`String` | `HINT_HORIZONTAL` Hint that list items within this slice or subslice would appear better if organized horizontally.
`String` | `HINT_KEYWORDS` A hint to indicate that the contents of this subslice represent a list of keywords related to the parent slice.
`String` | `HINT_LARGE` Hint that this content is important and should be larger when displayed if possible.
`String` | `HINT_LAST_UPDATED` Hint indicating an item representing when the content was created or last updated.
`String` | `HINT_LIST` Hint that all sub-items/sub-slices within this content should be considered to have `HINT_LIST_ITEM`.
`String` | `HINT_LIST_ITEM` Hint that this item is part of a list and should be formatted as if is part of a list.
`String` | `HINT_NO_TINT` Hint to indicate that this content should not be tinted.
`String` | `HINT_PARTIAL` Hint to indicate that this slice is incomplete and an update will be sent once loading is complete.
`String` | `HINT_PERMISSION_REQUEST` A hint to indicate that this slice represents a permission request for showing slices.
`String` | `HINT_SEE_MORE` A hint representing that this item should be used to indicate that there's more content associated with this slice.
`String` | `HINT_SELECTED` Hint indicating that this item (and its sub-items) are the current selection.
`String` | `HINT_SHORTCUT` Hint to indicate that this content should only be displayed if the slice is presented as a shortcut.
`String` | `HINT_SUMMARY` Hint indicating this content should be shown instead of the normal content when the slice is in small format.
`String` | `HINT_TITLE` Hint that this content is a title of other content in the slice.
`String` | `HINT_TTL` Hint indicating an item representing a time-to-live for the content.
`String` | `SUBTYPE_COLOR` Subtype to tag an item as representing a color.
`String` | `SUBTYPE_CONTENT_DESCRIPTION` Subtype to tag an item to use as a content description.
`String` | `SUBTYPE_LAYOUT_DIRECTION` Subtype to indicate that this item indicates the layout direction for content in the slice.
`String` | `SUBTYPE_MAX` Subtype to tag an item as representing the max int value for a `SUBTYPE_RANGE`.
`String` | `SUBTYPE_MESSAGE` Subtype to indicate that this is a message as part of a communication sequence in this slice.
`String` | `SUBTYPE_MILLIS` Subtype to tag an item as representing a time in milliseconds since midnight, January 1, 1970 UTC.
`String` | `SUBTYPE_PRIORITY` Subtype to tag an item representing priority.
`String` | `SUBTYPE_RANGE` Subtype to tag an item as representing a range.
`String` | `SUBTYPE_SOURCE` Subtype to tag the source (i.e.
`String` | `SUBTYPE_TOGGLE` Subtype to indicate that this content has a toggle action associated with it.
`String` | `SUBTYPE_VALUE` Subtype to tag an item as representing the current int value for a `SUBTYPE_RANGE`.

### Inherited constants
From interface `android.os.Parcelable`
`int` | `CONTENTS_FILE_DESCRIPTOR` Descriptor bit used with `describeContents()`: indicates that the Parcelable object's flattened representation includes a file descriptor.
`int` | `PARCELABLE_WRITE_RETURN_VALUE` Flag for use with `writeToParcel(Parcel, int)`: the object being written is a return value, that is the result of a function such as "`Parcelable someFunction()`", "`void someFunction(out Parcelable)`", or "`void someFunction(inout Parcelable)`".

### Fields
`public static final Creator<Slice>` | `CREATOR`

### Protected constructors
`Slice(Parcel in)`

### Public methods
`int` | `describeContents()` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.
`List<String>` | `getHints()`
`List<SliceItem>` | `getItems()`
`SliceSpec` | `getSpec()`
`Uri` | `getUri()`
`boolean` | `isCallerNeeded()` Returns whether the caller for this slice matters.
`void` | `writeToParcel(Parcel dest, int flags)` Flatten this object in to a Parcel.

### Inherited methods
From class `java.lang.Object`
`Object` | `clone()` Creates and returns a copy of this object.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
`void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
`int` | `hashCode()` Returns a hash code value for the object.
`final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
`final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
`String` | `toString()` Returns a string representation of the object.
`final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.
From interface `android.os.Parcelable`
`abstract int` | `describeContents()` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation.
`abstract void` | `writeToParcel(Parcel dest, int flags)` Flatten this object in to a Parcel.

## Constants

### EXTRA_RANGE_VALUE

    public static final String EXTRA_RANGE_VALUE

Key to retrieve an extra added to an intent when the value of an input range is changed.

Constant Value: "android.app.slice.extra.RANGE_VALUE"

### EXTRA_TOGGLE_STATE

    public static final String EXTRA_TOGGLE_STATE

Key to retrieve an extra added to an intent when a control is changed.

Constant Value: "android.app.slice.extra.TOGGLE_STATE"

### HINT_ACTIONS

    public static final String HINT_ACTIONS

Hint that this slice contains a number of actions that can be grouped together in a sort of controls area of the UI.

Constant Value: "actions"

### HINT_ERROR

    public static final String HINT_ERROR

A hint to indicate that this slice represents an error.

Constant Value: "error"

### HINT_HORIZONTAL

    public static final String HINT_HORIZONTAL

Hint that list items within this slice or subslice would appear better if organized horizontally.

Constant Value: "horizontal"

### HINT_KEYWORDS

    public static final String HINT_KEYWORDS

A hint to indicate that the contents of this subslice represent a list of keywords related to the parent slice. Expected to be on an item of format `SliceItem#FORMAT_SLICE`.

Constant Value: "keywords"

### HINT_LARGE

    public static final String HINT_LARGE

Hint that this content is important and should be larger when displayed if possible.

Constant Value: "large"

### HINT_LAST_UPDATED

    public static final String HINT_LAST_UPDATED

Hint indicating an item representing when the content was created or last updated.

Constant Value: "last_updated"

### HINT_LIST

    public static final String HINT_LIST

Hint that all sub-items/sub-slices within this content should be considered to have `HINT_LIST_ITEM`.

Constant Value: "list"

### HINT_LIST_ITEM

    public static final String HINT_LIST_ITEM

Hint that this item is part of a list and should be formatted as if is part of a list.

Constant Value: "list_item"

### HINT_NO_TINT

    public static final String HINT_NO_TINT

Hint to indicate that this content should not be tinted.

Constant Value: "no_tint"

### HINT_PARTIAL

    public static final String HINT_PARTIAL

Hint to indicate that this slice is incomplete and an update will be sent once loading is complete. Slices which contain HINT_PARTIAL will not be cached by the OS and should not be cached by apps.

Constant Value: "partial"

### HINT_PERMISSION_REQUEST

    public static final String HINT_PERMISSION_REQUEST

A hint to indicate that this slice represents a permission request for showing slices.

Constant Value: "permission_request"

### HINT_SEE_MORE

    public static final String HINT_SEE_MORE

A hint representing that this item should be used to indicate that there's more content associated with this slice.

Constant Value: "see_more"

### HINT_SELECTED

    public static final String HINT_SELECTED

Hint indicating that this item (and its sub-items) are the current selection.

Constant Value: "selected"

### HINT_SHORTCUT

    public static final String HINT_SHORTCUT

Hint to indicate that this content should only be displayed if the slice is presented as a shortcut.

Constant Value: "shortcut"

### HINT_SUMMARY

    public static final String HINT_SUMMARY

Hint indicating this content should be shown instead of the normal content when the slice is in small format.

Constant Value: "summary"

### HINT_TITLE

    public static final String HINT_TITLE

Hint that this content is a title of other content in the slice. This can also indicate that the content should be used in the shortcut representation of the slice (icon, label, action), normally this should be indicated by adding the hint on the action containing that content.

See also:

- `SliceItem.FORMAT_ACTION`

Constant Value: "title"

### HINT_TTL

    public static final String HINT_TTL

Hint indicating an item representing a time-to-live for the content.

Constant Value: "ttl"

### SUBTYPE_COLOR

    public static final String SUBTYPE_COLOR

Subtype to tag an item as representing a color. Expected to be on an item of format `SliceItem#FORMAT_INT`.

Constant Value: "color"

### SUBTYPE_CONTENT_DESCRIPTION

    public static final String SUBTYPE_CONTENT_DESCRIPTION

Subtype to tag an item to use as a content description. Expected to be on an item of format `SliceItem#FORMAT_TEXT`.

Constant Value: "content_description"

### SUBTYPE_LAYOUT_DIRECTION

    public static final String SUBTYPE_LAYOUT_DIRECTION

Subtype to indicate that this item indicates the layout direction for content in the slice. Expected to be an item of format `SliceItem#FORMAT_INT`.

Constant Value: "layout_direction"

### SUBTYPE_MAX

    public static final String SUBTYPE_MAX

Subtype to tag an item as representing the max int value for a `SUBTYPE_RANGE`. Expected to be on an item of format `SliceItem#FORMAT_INT`.

Constant Value: "max"

### SUBTYPE_MESSAGE

    public static final String SUBTYPE_MESSAGE

Subtype to indicate that this is a message as part of a communication sequence in this slice. Expected to be on an item of format `SliceItem#FORMAT_SLICE`.

Constant Value: "message"

### SUBTYPE_MILLIS

    public static final String SUBTYPE_MILLIS

Subtype to tag an item as representing a time in milliseconds since midnight, January 1, 1970 UTC.

Constant Value: "millis"

### SUBTYPE_PRIORITY

    public static final String SUBTYPE_PRIORITY

Subtype to tag an item representing priority. Expected to be on an item of format `SliceItem#FORMAT_INT`.

Constant Value: "priority"

### SUBTYPE_RANGE

    public static final String SUBTYPE_RANGE

Subtype to tag an item as representing a range. Expected to be on an item of format `SliceItem#FORMAT_SLICE` containing a `SUBTYPE_VALUE` and possibly a `SUBTYPE_MAX`.

Constant Value: "range"

### SUBTYPE_SOURCE

    public static final String SUBTYPE_SOURCE

Subtype to tag the source (i.e. sender) of a `SUBTYPE_MESSAGE`. Expected to be on an item of format `SliceItem#FORMAT_TEXT`, `SliceItem#FORMAT_IMAGE` or an `SliceItem#FORMAT_SLICE` containing them.

Constant Value: "source"

### SUBTYPE_TOGGLE

    public static final String SUBTYPE_TOGGLE

Subtype to indicate that this content has a toggle action associated with it. To indicate that the toggle is on, use `HINT_SELECTED`. When the toggle state changes, the intent associated with it will be sent along with an extra `EXTRA_TOGGLE_STATE` which can be retrieved to see the new state of the toggle.

Constant Value: "toggle"

### SUBTYPE_VALUE

    public static final String SUBTYPE_VALUE

Subtype to tag an item as representing the current int value for a `SUBTYPE_RANGE`. Expected to be on an item of format `SliceItem#FORMAT_INT`.

Constant Value: "value"

## Fields

### CREATOR

    public static final Creator<Slice> CREATOR

## Protected constructors

### Slice

    protected Slice (Parcel in)

Parameters
`in` | `Parcel`

## Public methods

### describeContents

    public int describeContents ()

Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. For example, if the object will include a file descriptor in the output of `writeToParcel(android.os.Parcel, int)`, the return value of this method must include the `CONTENTS_FILE_DESCRIPTOR` bit.

Returns
`int` | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either `0` or `CONTENTS_FILE_DESCRIPTOR`

### getHints

    public List<String> getHints ()

Returns
`List<String>` | All hints associated with this Slice. Value is `HINT_TITLE`, `HINT_LIST`, `HINT_LIST_ITEM`, `HINT_LARGE`, `HINT_ACTIONS`, `HINT_SELECTED`, `HINT_NO_TINT`, `HINT_SHORTCUT`, android.app.slice.Slice.HINT_TOGGLE, `HINT_HORIZONTAL`, `HINT_PARTIAL`, `HINT_SEE_MORE`, `HINT_KEYWORDS`, `HINT_ERROR`, `HINT_TTL`, `HINT_LAST_UPDATED`, or `HINT_PERMISSION_REQUEST`

### getItems

    public List<SliceItem> getItems ()

Returns
`List<SliceItem>` | All child `SliceItem`s that this Slice contains.

### getSpec

    public SliceSpec getSpec ()

Returns
`SliceSpec` | The spec for this slice This value may be `null`.

### getUri

    public Uri getUri ()

Returns
`Uri` | The Uri that this Slice represents.

### isCallerNeeded

    public boolean isCallerNeeded ()

Returns whether the caller for this slice matters.

Returns
`boolean` |

See also:

- `Slice.Builder.setCallerNeeded(boolean)`

### writeToParcel

    public void writeToParcel (Parcel dest,
                    int flags)

Flatten this object in to a Parcel.

Parameters
`dest` | `Parcel`: The Parcel in which the object should be written.
`flags` | `int`: Additional flags about how the object should be written. May be 0 or `Parcelable.PARCELABLE_WRITE_RETURN_VALUE`. Value is either `0` or a combination of `Parcelable.PARCELABLE_WRITE_RETURN_VALUE`, and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*