public static final class VoiceInteractor.PickOptionRequest.Option extends Object implements Parcelable
getIndex()
method should be used as a unique ID to identify the option
when it is returned from the voice interactor.Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
Modifier and Type | Field and Description |
---|---|
static Parcelable.Creator<VoiceInteractor.PickOptionRequest.Option> |
CREATOR |
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_ELIDE_DUPLICATES, PARCELABLE_WRITE_RETURN_VALUE
Constructor and Description |
---|
Option(CharSequence label)
Creates an option that a user can select with their voice by matching the label
or one of several synonyms.
|
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.
|
Modifier and Type | Method and Description |
---|---|
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
instance's marshaled 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.
|
public static final Parcelable.Creator<VoiceInteractor.PickOptionRequest.Option> CREATOR
public Option(CharSequence label)
label
- The label that will both be matched against what the user speaks
and displayed visually.public Option(CharSequence label, int index)
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 VoiceInteractor.PickOptionRequest.Option addSynonym(CharSequence synonym)
synonym
- The synonym that will be matched against what the user speaks,
but not displayed.public CharSequence getLabel()
public int getIndex()
public int countSynonyms()
public CharSequence getSynonymAt(int index)
public void setExtras(Bundle extras)
public Bundle getExtras()
public int describeContents()
Parcelable
Parcelable.writeToParcel(Parcel, int)
,
the return value of this method must include the
Parcelable.CONTENTS_FILE_DESCRIPTOR
bit.describeContents
in interface Parcelable
Parcelable.CONTENTS_FILE_DESCRIPTOR
public void writeToParcel(Parcel dest, int flags)
Parcelable
writeToParcel
in interface Parcelable
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.PARCELABLE_WRITE_RETURN_VALUE
.