Added in API level 28
Deprecated in API level 35

Builder


class Builder
kotlin.Any
   ↳ android.app.slice.Slice.Builder

A Builder used to construct Slices

Summary

Public constructors

Create a builder for a Slice that is a sub-slice of the slice being constructed by the provided builder.

Builder(uri: Uri, spec: SliceSpec!)

Create a builder which will construct a Slice for the given Uri.

Public methods
open Slice.Builder!
addAction(action: PendingIntent, s: Slice, subType: String?)

Add an action to the slice being constructed

open Slice.Builder!
addBundle(bundle: Bundle!, subType: String?, hints: MutableList<String!>!)

Add a bundle to the slice being constructed.

open Slice.Builder!

Add hints to the Slice being constructed

open Slice.Builder!
addIcon(icon: Icon!, subType: String?, hints: MutableList<String!>!)

Add an image to the slice being constructed

open Slice.Builder!
addInt(value: Int, subType: String?, hints: MutableList<String!>!)

Add an integer to the slice being constructed

open Slice.Builder!
addLong(value: Long, subType: String?, hints: MutableList<String!>!)

Add a long to the slice being constructed

open Slice.Builder!
addRemoteInput(remoteInput: RemoteInput!, subType: String?, hints: MutableList<String!>!)

Add remote input to the slice being constructed

open Slice.Builder!
addSubSlice(slice: Slice, subType: String?)

Add a sub-slice to the slice being constructed

open Slice.Builder!
addText(text: CharSequence!, subType: String?, hints: MutableList<String!>!)

Add text to the slice being constructed

open Slice!

Construct the slice.

open Slice.Builder!
setCallerNeeded(callerNeeded: Boolean)

Tells the system whether for this slice the return value of SliceProvider.onBindSlice(Uri, java.util.Set) may be different depending on SliceProvider.getCallingPackage() and should not be cached for multiple apps.

Public constructors

Builder

Added in API level 28
Builder(parent: Slice.Builder)

Create a builder for a Slice that is a sub-slice of the slice being constructed by the provided builder.

Parameters
parent Slice.Builder: The builder constructing the parent slice This value cannot be null.

Builder

Added in API level 28
Builder(
    uri: Uri,
    spec: SliceSpec!)

Create a builder which will construct a Slice for the given Uri.

Parameters
uri Uri: Uri to tag for this slice. This value cannot be null.
spec SliceSpec!: the spec for this slice.

Public methods

addAction

Added in API level 28
open fun addAction(
    action: PendingIntent,
    s: Slice,
    subType: String?
): Slice.Builder!

Deprecated: Deprecated in Java.

Add an action to the slice being constructed

Parameters
subType String?: Optional template-specific type information This value may be null. Value is android.app.slice.Slice#SUBTYPE_COLOR, android.app.slice.Slice#SUBTYPE_CONTENT_DESCRIPTION, android.app.slice.Slice#SUBTYPE_MAX, android.app.slice.Slice#SUBTYPE_MESSAGE, android.app.slice.Slice#SUBTYPE_PRIORITY, android.app.slice.Slice#SUBTYPE_RANGE, android.app.slice.Slice#SUBTYPE_SOURCE, android.app.slice.Slice#SUBTYPE_TOGGLE, android.app.slice.Slice#SUBTYPE_VALUE, or android.app.slice.Slice#SUBTYPE_LAYOUT_DIRECTION
action PendingIntent: This value cannot be null.
s Slice: This value cannot be null.

addBundle

Added in API level 28
open fun addBundle(
    bundle: Bundle!,
    subType: String?,
    hints: MutableList<String!>!
): Slice.Builder!

Deprecated: Deprecated in Java.

Add a bundle to the slice being constructed.

Expected to be used for support library extension, should not be used for general development

Parameters
subType String?: Optional template-specific type information This value may be null. Value is android.app.slice.Slice#SUBTYPE_COLOR, android.app.slice.Slice#SUBTYPE_CONTENT_DESCRIPTION, android.app.slice.Slice#SUBTYPE_MAX, android.app.slice.Slice#SUBTYPE_MESSAGE, android.app.slice.Slice#SUBTYPE_PRIORITY, android.app.slice.Slice#SUBTYPE_RANGE, android.app.slice.Slice#SUBTYPE_SOURCE, android.app.slice.Slice#SUBTYPE_TOGGLE, android.app.slice.Slice#SUBTYPE_VALUE, or android.app.slice.Slice#SUBTYPE_LAYOUT_DIRECTION
hints MutableList<String!>!: Value is android.app.slice.Slice#HINT_TITLE, android.app.slice.Slice#HINT_LIST, android.app.slice.Slice#HINT_LIST_ITEM, android.app.slice.Slice#HINT_LARGE, android.app.slice.Slice#HINT_ACTIONS, android.app.slice.Slice#HINT_SELECTED, android.app.slice.Slice#HINT_NO_TINT, android.app.slice.Slice#HINT_SHORTCUT, android.app.slice.Slice.HINT_TOGGLE, android.app.slice.Slice#HINT_HORIZONTAL, android.app.slice.Slice#HINT_PARTIAL, android.app.slice.Slice#HINT_SEE_MORE, android.app.slice.Slice#HINT_KEYWORDS, android.app.slice.Slice#HINT_ERROR, android.app.slice.Slice#HINT_TTL, android.app.slice.Slice#HINT_LAST_UPDATED, or android.app.slice.Slice#HINT_PERMISSION_REQUEST

addIcon

Added in API level 28
open fun addIcon(
    icon: Icon!,
    subType: String?,
    hints: MutableList<String!>!
): Slice.Builder!

Deprecated: Deprecated in Java.

Add an image to the slice being constructed

Parameters
subType String?: Optional template-specific type information This value may be null. Value is android.app.slice.Slice#SUBTYPE_COLOR, android.app.slice.Slice#SUBTYPE_CONTENT_DESCRIPTION, android.app.slice.Slice#SUBTYPE_MAX, android.app.slice.Slice#SUBTYPE_MESSAGE, android.app.slice.Slice#SUBTYPE_PRIORITY, android.app.slice.Slice#SUBTYPE_RANGE, android.app.slice.Slice#SUBTYPE_SOURCE, android.app.slice.Slice#SUBTYPE_TOGGLE, android.app.slice.Slice#SUBTYPE_VALUE, or android.app.slice.Slice#SUBTYPE_LAYOUT_DIRECTION
hints MutableList<String!>!: Value is android.app.slice.Slice#HINT_TITLE, android.app.slice.Slice#HINT_LIST, android.app.slice.Slice#HINT_LIST_ITEM, android.app.slice.Slice#HINT_LARGE, android.app.slice.Slice#HINT_ACTIONS, android.app.slice.Slice#HINT_SELECTED, android.app.slice.Slice#HINT_NO_TINT, android.app.slice.Slice#HINT_SHORTCUT, android.app.slice.Slice.HINT_TOGGLE, android.app.slice.Slice#HINT_HORIZONTAL, android.app.slice.Slice#HINT_PARTIAL, android.app.slice.Slice#HINT_SEE_MORE, android.app.slice.Slice#HINT_KEYWORDS, android.app.slice.Slice#HINT_ERROR, android.app.slice.Slice#HINT_TTL, android.app.slice.Slice#HINT_LAST_UPDATED, or android.app.slice.Slice#HINT_PERMISSION_REQUEST

addInt

Added in API level 28
open fun addInt(
    value: Int,
    subType: String?,
    hints: MutableList<String!>!
): Slice.Builder!

Deprecated: Deprecated in Java.

Add an integer to the slice being constructed

Parameters
subType String?: Optional template-specific type information This value may be null. Value is android.app.slice.Slice#SUBTYPE_COLOR, android.app.slice.Slice#SUBTYPE_CONTENT_DESCRIPTION, android.app.slice.Slice#SUBTYPE_MAX, android.app.slice.Slice#SUBTYPE_MESSAGE, android.app.slice.Slice#SUBTYPE_PRIORITY, android.app.slice.Slice#SUBTYPE_RANGE, android.app.slice.Slice#SUBTYPE_SOURCE, android.app.slice.Slice#SUBTYPE_TOGGLE, android.app.slice.Slice#SUBTYPE_VALUE, or android.app.slice.Slice#SUBTYPE_LAYOUT_DIRECTION
hints MutableList<String!>!: Value is android.app.slice.Slice#HINT_TITLE, android.app.slice.Slice#HINT_LIST, android.app.slice.Slice#HINT_LIST_ITEM, android.app.slice.Slice#HINT_LARGE, android.app.slice.Slice#HINT_ACTIONS, android.app.slice.Slice#HINT_SELECTED, android.app.slice.Slice#HINT_NO_TINT, android.app.slice.Slice#HINT_SHORTCUT, android.app.slice.Slice.HINT_TOGGLE, android.app.slice.Slice#HINT_HORIZONTAL, android.app.slice.Slice#HINT_PARTIAL, android.app.slice.Slice#HINT_SEE_MORE, android.app.slice.Slice#HINT_KEYWORDS, android.app.slice.Slice#HINT_ERROR, android.app.slice.Slice#HINT_TTL, android.app.slice.Slice#HINT_LAST_UPDATED, or android.app.slice.Slice#HINT_PERMISSION_REQUEST

addRemoteInput

Added in API level 28
open fun addRemoteInput(
    remoteInput: RemoteInput!,
    subType: String?,
    hints: MutableList<String!>!
): Slice.Builder!

Deprecated: Deprecated in Java.

Add remote input to the slice being constructed

Parameters
subType String?: Optional template-specific type information This value may be null. Value is android.app.slice.Slice#SUBTYPE_COLOR, android.app.slice.Slice#SUBTYPE_CONTENT_DESCRIPTION, android.app.slice.Slice#SUBTYPE_MAX, android.app.slice.Slice#SUBTYPE_MESSAGE, android.app.slice.Slice#SUBTYPE_PRIORITY, android.app.slice.Slice#SUBTYPE_RANGE, android.app.slice.Slice#SUBTYPE_SOURCE, android.app.slice.Slice#SUBTYPE_TOGGLE, android.app.slice.Slice#SUBTYPE_VALUE, or android.app.slice.Slice#SUBTYPE_LAYOUT_DIRECTION
hints MutableList<String!>!: Value is android.app.slice.Slice#HINT_TITLE, android.app.slice.Slice#HINT_LIST, android.app.slice.Slice#HINT_LIST_ITEM, android.app.slice.Slice#HINT_LARGE, android.app.slice.Slice#HINT_ACTIONS, android.app.slice.Slice#HINT_SELECTED, android.app.slice.Slice#HINT_NO_TINT, android.app.slice.Slice#HINT_SHORTCUT, android.app.slice.Slice.HINT_TOGGLE, android.app.slice.Slice#HINT_HORIZONTAL, android.app.slice.Slice#HINT_PARTIAL, android.app.slice.Slice#HINT_SEE_MORE, android.app.slice.Slice#HINT_KEYWORDS, android.app.slice.Slice#HINT_ERROR, android.app.slice.Slice#HINT_TTL, android.app.slice.Slice#HINT_LAST_UPDATED, or android.app.slice.Slice#HINT_PERMISSION_REQUEST

addSubSlice

Added in API level 28
open fun addSubSlice(
    slice: Slice,
    subType: String?
): Slice.Builder!

Deprecated: Deprecated in Java.

Add a sub-slice to the slice being constructed

Parameters
subType String?: Optional template-specific type information This value may be null. Value is android.app.slice.Slice#SUBTYPE_COLOR, android.app.slice.Slice#SUBTYPE_CONTENT_DESCRIPTION, android.app.slice.Slice#SUBTYPE_MAX, android.app.slice.Slice#SUBTYPE_MESSAGE, android.app.slice.Slice#SUBTYPE_PRIORITY, android.app.slice.Slice#SUBTYPE_RANGE, android.app.slice.Slice#SUBTYPE_SOURCE, android.app.slice.Slice#SUBTYPE_TOGGLE, android.app.slice.Slice#SUBTYPE_VALUE, or android.app.slice.Slice#SUBTYPE_LAYOUT_DIRECTION
slice Slice: This value cannot be null.

addText

Added in API level 28
open fun addText(
    text: CharSequence!,
    subType: String?,
    hints: MutableList<String!>!
): Slice.Builder!

Deprecated: Deprecated in Java.

Add text to the slice being constructed

Parameters
subType String?: Optional template-specific type information This value may be null. Value is android.app.slice.Slice#SUBTYPE_COLOR, android.app.slice.Slice#SUBTYPE_CONTENT_DESCRIPTION, android.app.slice.Slice#SUBTYPE_MAX, android.app.slice.Slice#SUBTYPE_MESSAGE, android.app.slice.Slice#SUBTYPE_PRIORITY, android.app.slice.Slice#SUBTYPE_RANGE, android.app.slice.Slice#SUBTYPE_SOURCE, android.app.slice.Slice#SUBTYPE_TOGGLE, android.app.slice.Slice#SUBTYPE_VALUE, or android.app.slice.Slice#SUBTYPE_LAYOUT_DIRECTION
hints MutableList<String!>!: Value is android.app.slice.Slice#HINT_TITLE, android.app.slice.Slice#HINT_LIST, android.app.slice.Slice#HINT_LIST_ITEM, android.app.slice.Slice#HINT_LARGE, android.app.slice.Slice#HINT_ACTIONS, android.app.slice.Slice#HINT_SELECTED, android.app.slice.Slice#HINT_NO_TINT, android.app.slice.Slice#HINT_SHORTCUT, android.app.slice.Slice.HINT_TOGGLE, android.app.slice.Slice#HINT_HORIZONTAL, android.app.slice.Slice#HINT_PARTIAL, android.app.slice.Slice#HINT_SEE_MORE, android.app.slice.Slice#HINT_KEYWORDS, android.app.slice.Slice#HINT_ERROR, android.app.slice.Slice#HINT_TTL, android.app.slice.Slice#HINT_LAST_UPDATED, or android.app.slice.Slice#HINT_PERMISSION_REQUEST

build

Added in API level 28
open fun build(): Slice!

Deprecated: Deprecated in Java.

Construct the slice.

setCallerNeeded

Added in API level 28
open fun setCallerNeeded(callerNeeded: Boolean): Slice.Builder!

Deprecated: Deprecated in Java.

Tells the system whether for this slice the return value of SliceProvider.onBindSlice(Uri, java.util.Set) may be different depending on SliceProvider.getCallingPackage() and should not be cached for multiple apps.