Android APIs
public static final class

VoiceInteractor.PickOptionRequest.Option

extends Object
implements Parcelable
java.lang.Object
   ↳ android.app.VoiceInteractor.PickOptionRequest.Option

Class Overview

Represents a single option that the user may select using their voice. The getIndex() method should be used as a unique ID to identify the option when it is returned from the voice interactor.

Summary

[Expand]
Inherited Constants
From interface android.os.Parcelable
Fields
public static final Creator<VoiceInteractor.PickOptionRequest.Option> CREATOR
Public Constructors
VoiceInteractor.PickOptionRequest.Option(CharSequence label, int index)
Creates an option that a user can select with their voice by matching the label or one of several synonyms.
Public Methods
VoiceInteractor.PickOptionRequest.Option addSynonym(CharSequence synonym)
Add a synonym term to the option to indicate an alternative way the content may be matched.
int countSynonyms()
int describeContents()
Describe the kinds of special objects contained in this Parcelable's marshalled representation.
Bundle getExtras()
Return any optional extras information associated with this option, or null if there is none.
int getIndex()
Return the index that was supplied in the constructor.
CharSequence getLabel()
CharSequence getSynonymAt(int index)
void setExtras(Bundle extras)
Set optional extra information associated with this option.
void writeToParcel(Parcel dest, int flags)
Flatten this object in to a Parcel.
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Fields

public static final Creator<VoiceInteractor.PickOptionRequest.Option> CREATOR

Added in API level 23

Public Constructors

public VoiceInteractor.PickOptionRequest.Option (CharSequence label, int index)

Added in API level 23

Creates an option that a user can select with their voice by matching the label or one of several synonyms.

Parameters
label The label that will both be matched against what the user speaks and displayed visually.
index The location of this option within the overall set of options. Can be used to help identify the option when it is returned from the voice interactor.

Public Methods

public VoiceInteractor.PickOptionRequest.Option addSynonym (CharSequence synonym)

Added in API level 23

Add a synonym term to the option to indicate an alternative way the content may be matched.

Parameters
synonym The synonym that will be matched against what the user speaks, but not displayed.

public int countSynonyms ()

Added in API level 23

public int describeContents ()

Added in API level 23

Describe the kinds of special objects contained in this Parcelable's marshalled representation.

Returns
  • a bitmask indicating the set of special object types marshalled by the Parcelable.

public Bundle getExtras ()

Added in API level 23

Return any optional extras information associated with this option, or null if there is none. Note that this method returns a reference to the actual extras Bundle in the option, so modifications to it will directly modify the extras in the option.

public int getIndex ()

Added in API level 23

Return the index that was supplied in the constructor. If the option was constructed without an index, -1 is returned.

public CharSequence getLabel ()

Added in API level 23

public CharSequence getSynonymAt (int index)

Added in API level 23

public void setExtras (Bundle extras)

Added in API level 23

Set optional extra information associated with this option. Note that this method takes ownership of the supplied extras Bundle.

public void writeToParcel (Parcel dest, int flags)

Added in API level 23

Flatten this object in to a Parcel.

Parameters
dest The Parcel in which the object should be written.
flags Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE.