Slice.Builder
public
static
class
Slice.Builder
extends Object
java.lang.Object | |
↳ | android.app.slice.Slice.Builder |
This class was deprecated
in API level 35.
Slice framework has been deprecated, it will not receive any updates from
ERROR(/android.os.Build.VANILLA_ICE_CREAM)
and forward. If you are looking for a
framework that sends displayable data from one app to another, consider using
AppSearchManager
.
A Builder used to construct Slice
s
Summary
Public constructors | |
---|---|
Builder(Uri uri, SliceSpec spec)
Create a builder which will construct a |
|
Builder(Slice.Builder parent)
Create a builder for a |
Public methods | |
---|---|
Slice.Builder
|
addAction(PendingIntent action, Slice s, String subType)
Add an action to the slice being constructed |
Slice.Builder
|
addBundle(Bundle bundle, String subType, List<String> hints)
Add a bundle to the slice being constructed. |
Slice.Builder
|
addHints(List<String> hints)
Add hints to the Slice being constructed |
Slice.Builder
|
addIcon(Icon icon, String subType, List<String> hints)
Add an image to the slice being constructed |
Slice.Builder
|
addInt(int value, String subType, List<String> hints)
Add an integer to the slice being constructed |
Slice.Builder
|
addLong(long value, String subType, List<String> hints)
Add a long to the slice being constructed |
Slice.Builder
|
addRemoteInput(RemoteInput remoteInput, String subType, List<String> hints)
Add remote input to the slice being constructed |
Slice.Builder
|
addSubSlice(Slice slice, String subType)
Add a sub-slice to the slice being constructed |
Slice.Builder
|
addText(CharSequence text, String subType, List<String> hints)
Add text to the slice being constructed |
Slice
|
build()
Construct the slice. |
Slice.Builder
|
setCallerNeeded(boolean callerNeeded)
Tells the system whether for this slice the return value of
|
Inherited methods | |
---|---|
Public constructors
Builder
public Builder (Uri uri, SliceSpec spec)
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. |
Builder
public Builder (Slice.Builder parent)
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 . |
Public methods
addAction
public Slice.Builder addAction (PendingIntent action, Slice s, String subType)
Add an action to the slice being constructed
Parameters | |
---|---|
action |
PendingIntent : This value cannot be null . |
s |
Slice : This value cannot be null . |
subType |
String : Optional template-specific type information
This value may be null .
Value is Slice.SUBTYPE_COLOR , Slice.SUBTYPE_CONTENT_DESCRIPTION , Slice.SUBTYPE_MAX , Slice.SUBTYPE_MESSAGE , Slice.SUBTYPE_PRIORITY , Slice.SUBTYPE_RANGE , Slice.SUBTYPE_SOURCE , Slice.SUBTYPE_TOGGLE , Slice.SUBTYPE_VALUE , or Slice.SUBTYPE_LAYOUT_DIRECTION |
Returns | |
---|---|
Slice.Builder |
See also:
addBundle
public Slice.Builder addBundle (Bundle bundle, String subType, List<String> hints)
Add a bundle to the slice being constructed.
Expected to be used for support library extension, should not be used for general development
Parameters | |
---|---|
bundle |
Bundle |
subType |
String : Optional template-specific type information
This value may be null .
Value is Slice.SUBTYPE_COLOR , Slice.SUBTYPE_CONTENT_DESCRIPTION , Slice.SUBTYPE_MAX , Slice.SUBTYPE_MESSAGE , Slice.SUBTYPE_PRIORITY , Slice.SUBTYPE_RANGE , Slice.SUBTYPE_SOURCE , Slice.SUBTYPE_TOGGLE , Slice.SUBTYPE_VALUE , or Slice.SUBTYPE_LAYOUT_DIRECTION |
hints |
List : Value is Slice.HINT_TITLE , Slice.HINT_LIST , Slice.HINT_LIST_ITEM , Slice.HINT_LARGE , Slice.HINT_ACTIONS , Slice.HINT_SELECTED , Slice.HINT_NO_TINT , Slice.HINT_SHORTCUT , android.app.slice.Slice.HINT_TOGGLE, Slice.HINT_HORIZONTAL , Slice.HINT_PARTIAL , Slice.HINT_SEE_MORE , Slice.HINT_KEYWORDS , Slice.HINT_ERROR , Slice.HINT_TTL , Slice.HINT_LAST_UPDATED , or Slice.HINT_PERMISSION_REQUEST |
Returns | |
---|---|
Slice.Builder |
See also:
addHints
public Slice.Builder addHints (List<String> hints)
Add hints to the Slice being constructed
Parameters | |
---|---|
hints |
List : Value is Slice.HINT_TITLE , Slice.HINT_LIST , Slice.HINT_LIST_ITEM , Slice.HINT_LARGE , Slice.HINT_ACTIONS , Slice.HINT_SELECTED , Slice.HINT_NO_TINT , Slice.HINT_SHORTCUT , android.app.slice.Slice.HINT_TOGGLE, Slice.HINT_HORIZONTAL , Slice.HINT_PARTIAL , Slice.HINT_SEE_MORE , Slice.HINT_KEYWORDS , Slice.HINT_ERROR , Slice.HINT_TTL , Slice.HINT_LAST_UPDATED , or Slice.HINT_PERMISSION_REQUEST |
Returns | |
---|---|
Slice.Builder |
addIcon
public Slice.Builder addIcon (Icon icon, String subType, List<String> hints)
Add an image to the slice being constructed
Parameters | |
---|---|
icon |
Icon |
subType |
String : Optional template-specific type information
This value may be null .
Value is Slice.SUBTYPE_COLOR , Slice.SUBTYPE_CONTENT_DESCRIPTION , Slice.SUBTYPE_MAX , Slice.SUBTYPE_MESSAGE , Slice.SUBTYPE_PRIORITY , Slice.SUBTYPE_RANGE , Slice.SUBTYPE_SOURCE , Slice.SUBTYPE_TOGGLE , Slice.SUBTYPE_VALUE , or Slice.SUBTYPE_LAYOUT_DIRECTION |
hints |
List : Value is Slice.HINT_TITLE , Slice.HINT_LIST , Slice.HINT_LIST_ITEM , Slice.HINT_LARGE , Slice.HINT_ACTIONS , Slice.HINT_SELECTED , Slice.HINT_NO_TINT , Slice.HINT_SHORTCUT , android.app.slice.Slice.HINT_TOGGLE, Slice.HINT_HORIZONTAL , Slice.HINT_PARTIAL , Slice.HINT_SEE_MORE , Slice.HINT_KEYWORDS , Slice.HINT_ERROR , Slice.HINT_TTL , Slice.HINT_LAST_UPDATED , or Slice.HINT_PERMISSION_REQUEST |
Returns | |
---|---|
Slice.Builder |
See also:
addInt
public Slice.Builder addInt (int value, String subType, List<String> hints)
Add an integer to the slice being constructed
Parameters | |
---|---|
value |
int |
subType |
String : Optional template-specific type information
This value may be null .
Value is Slice.SUBTYPE_COLOR , Slice.SUBTYPE_CONTENT_DESCRIPTION , Slice.SUBTYPE_MAX , Slice.SUBTYPE_MESSAGE , Slice.SUBTYPE_PRIORITY , Slice.SUBTYPE_RANGE , Slice.SUBTYPE_SOURCE , Slice.SUBTYPE_TOGGLE , Slice.SUBTYPE_VALUE , or Slice.SUBTYPE_LAYOUT_DIRECTION |
hints |
List : Value is Slice.HINT_TITLE , Slice.HINT_LIST , Slice.HINT_LIST_ITEM , Slice.HINT_LARGE , Slice.HINT_ACTIONS , Slice.HINT_SELECTED , Slice.HINT_NO_TINT , Slice.HINT_SHORTCUT , android.app.slice.Slice.HINT_TOGGLE, Slice.HINT_HORIZONTAL , Slice.HINT_PARTIAL , Slice.HINT_SEE_MORE , Slice.HINT_KEYWORDS , Slice.HINT_ERROR , Slice.HINT_TTL , Slice.HINT_LAST_UPDATED , or Slice.HINT_PERMISSION_REQUEST |
Returns | |
---|---|
Slice.Builder |
See also:
addLong
public Slice.Builder addLong (long value, String subType, List<String> hints)
Add a long to the slice being constructed
Parameters | |
---|---|
value |
long |
subType |
String : Optional template-specific type information
This value may be null .
Value is Slice.SUBTYPE_COLOR , Slice.SUBTYPE_CONTENT_DESCRIPTION , Slice.SUBTYPE_MAX , Slice.SUBTYPE_MESSAGE , Slice.SUBTYPE_PRIORITY , Slice.SUBTYPE_RANGE , Slice.SUBTYPE_SOURCE , Slice.SUBTYPE_TOGGLE , Slice.SUBTYPE_VALUE , or Slice.SUBTYPE_LAYOUT_DIRECTION |
hints |
List : Value is Slice.HINT_TITLE , Slice.HINT_LIST , Slice.HINT_LIST_ITEM , Slice.HINT_LARGE , Slice.HINT_ACTIONS , Slice.HINT_SELECTED , Slice.HINT_NO_TINT , Slice.HINT_SHORTCUT , android.app.slice.Slice.HINT_TOGGLE, Slice.HINT_HORIZONTAL , Slice.HINT_PARTIAL , Slice.HINT_SEE_MORE , Slice.HINT_KEYWORDS , Slice.HINT_ERROR , Slice.HINT_TTL , Slice.HINT_LAST_UPDATED , or Slice.HINT_PERMISSION_REQUEST |
Returns | |
---|---|
Slice.Builder |
See also:
addRemoteInput
public Slice.Builder addRemoteInput (RemoteInput remoteInput, String subType, List<String> hints)
Add remote input to the slice being constructed
Parameters | |
---|---|
remoteInput |
RemoteInput |
subType |
String : Optional template-specific type information
This value may be null .
Value is Slice.SUBTYPE_COLOR , Slice.SUBTYPE_CONTENT_DESCRIPTION , Slice.SUBTYPE_MAX , Slice.SUBTYPE_MESSAGE , Slice.SUBTYPE_PRIORITY , Slice.SUBTYPE_RANGE , Slice.SUBTYPE_SOURCE , Slice.SUBTYPE_TOGGLE , Slice.SUBTYPE_VALUE , or Slice.SUBTYPE_LAYOUT_DIRECTION |
hints |
List : Value is Slice.HINT_TITLE , Slice.HINT_LIST , Slice.HINT_LIST_ITEM , Slice.HINT_LARGE , Slice.HINT_ACTIONS , Slice.HINT_SELECTED , Slice.HINT_NO_TINT , Slice.HINT_SHORTCUT , android.app.slice.Slice.HINT_TOGGLE, Slice.HINT_HORIZONTAL , Slice.HINT_PARTIAL , Slice.HINT_SEE_MORE , Slice.HINT_KEYWORDS , Slice.HINT_ERROR , Slice.HINT_TTL , Slice.HINT_LAST_UPDATED , or Slice.HINT_PERMISSION_REQUEST |
Returns | |
---|---|
Slice.Builder |
See also:
addSubSlice
public Slice.Builder addSubSlice (Slice slice, String subType)
Add a sub-slice to the slice being constructed
Parameters | |
---|---|
slice |
Slice : This value cannot be null . |
subType |
String : Optional template-specific type information
This value may be null .
Value is Slice.SUBTYPE_COLOR , Slice.SUBTYPE_CONTENT_DESCRIPTION , Slice.SUBTYPE_MAX , Slice.SUBTYPE_MESSAGE , Slice.SUBTYPE_PRIORITY , Slice.SUBTYPE_RANGE , Slice.SUBTYPE_SOURCE , Slice.SUBTYPE_TOGGLE , Slice.SUBTYPE_VALUE , or Slice.SUBTYPE_LAYOUT_DIRECTION |
Returns | |
---|---|
Slice.Builder |
See also:
addText
public Slice.Builder addText (CharSequence text, String subType, List<String> hints)
Add text to the slice being constructed
Parameters | |
---|---|
text |
CharSequence |
subType |
String : Optional template-specific type information
This value may be null .
Value is Slice.SUBTYPE_COLOR , Slice.SUBTYPE_CONTENT_DESCRIPTION , Slice.SUBTYPE_MAX , Slice.SUBTYPE_MESSAGE , Slice.SUBTYPE_PRIORITY , Slice.SUBTYPE_RANGE , Slice.SUBTYPE_SOURCE , Slice.SUBTYPE_TOGGLE , Slice.SUBTYPE_VALUE , or Slice.SUBTYPE_LAYOUT_DIRECTION |
hints |
List : Value is Slice.HINT_TITLE , Slice.HINT_LIST , Slice.HINT_LIST_ITEM , Slice.HINT_LARGE , Slice.HINT_ACTIONS , Slice.HINT_SELECTED , Slice.HINT_NO_TINT , Slice.HINT_SHORTCUT , android.app.slice.Slice.HINT_TOGGLE, Slice.HINT_HORIZONTAL , Slice.HINT_PARTIAL , Slice.HINT_SEE_MORE , Slice.HINT_KEYWORDS , Slice.HINT_ERROR , Slice.HINT_TTL , Slice.HINT_LAST_UPDATED , or Slice.HINT_PERMISSION_REQUEST |
Returns | |
---|---|
Slice.Builder |
See also:
setCallerNeeded
public Slice.Builder setCallerNeeded (boolean callerNeeded)
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.
Parameters | |
---|---|
callerNeeded |
boolean |
Returns | |
---|---|
Slice.Builder |