ChooserTarget
classChooserTarget: Parcelable
kotlin.Any | |
↳ | android.service.chooser.ChooserTarget |
A ChooserTarget represents a deep-link into an application as returned by a android.service.chooser.ChooserTargetService
.
A chooser target represents a specific deep link target into an application exposed for selection by the user. This might be a frequently emailed contact, a recently active group messaging conversation, a folder in a cloud storage app, a collection of related items published on a social media service or any other contextually relevant grouping of target app + relevant metadata.
Creators of chooser targets should consult the relevant design guidelines for the type of target they are presenting. For example, targets involving people should be presented with a circular icon.
Summary
Inherited constants | |
---|---|
Public constructors | |
---|---|
ChooserTarget(title: CharSequence!, icon: Icon!, score: Float, componentName: ComponentName!, intentExtras: Bundle?) Construct a deep link target for presentation by a chooser UI. |
Public methods | |
---|---|
Int | |
ComponentName! |
Returns the ComponentName of the Activity that should be launched for this ChooserTarget. |
Icon! |
getIcon() Returns the icon representing this target for display to a user. |
Bundle! |
Returns the Bundle of extras to be added to an intent launched to this target. |
Float |
getScore() Returns the ranking score supplied by the creator of this ChooserTarget. |
CharSequence! |
getTitle() Returns the title of this target for display to a user. |
String |
toString() |
Unit |
writeToParcel(dest: Parcel, flags: Int) |
Properties | |
---|---|
static Parcelable.Creator<ChooserTarget!> |
Public constructors
ChooserTarget
ChooserTarget(
title: CharSequence!,
icon: Icon!,
score: Float,
componentName: ComponentName!,
intentExtras: Bundle?)
Construct a deep link target for presentation by a chooser UI.
A target is composed of a title and an icon for presentation to the user. The UI presenting this target may truncate the title if it is too long to be presented in the available space, as well as crop, resize or overlay the supplied icon.
The creator of a target may supply a ranking score. This score is assumed to be relative to the other targets supplied by the same query
. Scores should be in the range from 0.0f (unlikely match) to 1.0f (very relevant match). Scores for a set of targets do not need to sum to 1.
The ComponentName must be the name of an Activity component in the creator's own package, or an exported component from any other package. You may provide an optional Bundle of extras that will be merged into the final intent before it is sent to the target Activity; use this to add any additional data about the deep link that the target activity will read. e.g. conversation IDs, email addresses, etc.
Take care not to place custom android.os.Parcelable
types into the extras bundle, as the system will not be able to unparcel them to merge them.
Parameters | |
---|---|
title |
CharSequence!: title of this target that will be shown to a user |
icon |
Icon!: icon to represent this target |
score |
Float: ranking score for this target between 0.0f and 1.0f, inclusive |
componentName |
ComponentName!: Name of the component to be launched if this target is chosen |
intentExtras |
Bundle?: Bundle of extras to merge with the extras of the launched intent This value may be null . |
Public methods
describeContents
fundescribeContents(): Int
Deprecated: Deprecated in Java.
Return | |
---|---|
Int |
a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR |
getComponentName
fungetComponentName(): ComponentName!
Deprecated: Deprecated in Java.
Returns the ComponentName of the Activity that should be launched for this ChooserTarget.
Return | |
---|---|
ComponentName! |
the name of the target Activity to launch |
getIcon
fungetIcon(): Icon!
Deprecated: Deprecated in Java.
Returns the icon representing this target for display to a user. The UI displaying the icon may crop, resize or overlay this icon.
Return | |
---|---|
Icon! |
the icon representing this target, intended to be shown to a user |
getIntentExtras
fungetIntentExtras(): Bundle!
Deprecated: Deprecated in Java.
Returns the Bundle of extras to be added to an intent launched to this target.
Return | |
---|---|
Bundle! |
the extras to merge with the extras of the intent being launched |
getScore
fungetScore(): Float
Deprecated: Deprecated in Java.
Returns the ranking score supplied by the creator of this ChooserTarget. Values are between 0.0f and 1.0f. The UI displaying the target may take this score into account when sorting and merging targets from multiple sources.
Return | |
---|---|
Float |
the ranking score for this target between 0.0f and 1.0f, inclusive |
getTitle
fungetTitle(): CharSequence!
Deprecated: Deprecated in Java.
Returns the title of this target for display to a user. The UI displaying the title may truncate this title if it is too long to be displayed in full.
Return | |
---|---|
CharSequence! |
the title of this target, intended to be shown to a user |
toString
funtoString(): String
Deprecated: Deprecated in Java.
Return | |
---|---|
String |
a string representation of the object. |
writeToParcel
funwriteToParcel(
dest: Parcel,
flags: Int
): Unit
Deprecated: Deprecated in Java.
Parameters | |
---|---|
dest |
Parcel: The Parcel in which the object should be written. This value cannot be null . |
flags |
Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE . Value is either 0 or a combination of android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE , and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |
Properties
CREATOR
static valCREATOR: Parcelable.Creator<ChooserTarget!>
Deprecated: Deprecated in Java.