Most visited

Recently visited

Added in API level 23

VoiceInteractor.PickOptionRequest.Option

public static final class VoiceInteractor.PickOptionRequest.Option
extends Object implements Parcelable

java.lang.Object
   ↳ android.app.VoiceInteractor.PickOptionRequest.Option


表示用户可以使用他们的语音选择的单个选项。 应该使用getIndex()方法作为唯一ID来标识从语音交互器返回的选项。

Summary

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)

创建一个选项,用户可以通过匹配标签或几个同义词之一来选择其语音。

Public methods

VoiceInteractor.PickOptionRequest.Option addSynonym(CharSequence synonym)

为选项添加同义词,以指示内容可以匹配的替代方式。

int countSynonyms()
int describeContents()

描述此Parcelable实例的封送表示中包含的特殊对象的种类。

Bundle getExtras()

返回与此选项关联的所有可选附加信息,如果没有,则返回null。

int getIndex()

返回构造函数中提供的索引。

CharSequence getLabel()
CharSequence getSynonymAt(int index)
void setExtras(Bundle extras)

设置与此选项关联的可选附加信息。

void writeToParcel(Parcel dest, int flags)

将此对象平铺到一个包裹中。

Inherited methods

From class java.lang.Object
From interface android.os.Parcelable

Fields

Public constructors

VoiceInteractor.PickOptionRequest.Option

Added in API level 23
VoiceInteractor.PickOptionRequest.Option (CharSequence label, 
                int index)

创建一个选项,用户可以通过匹配标签或几个同义词之一来选择其语音。

Parameters
label CharSequence: The label that will both be matched against what the user speaks and displayed visually.
index int: 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

addSynonym

Added in API level 23
VoiceInteractor.PickOptionRequest.Option addSynonym (CharSequence synonym)

为选项添加同义词,以指示内容可以匹配的替代方式。

Parameters
synonym CharSequence: The synonym that will be matched against what the user speaks, but not displayed.
Returns
VoiceInteractor.PickOptionRequest.Option

countSynonyms

Added in API level 23
int countSynonyms ()

Returns
int

describeContents

Added in API level 23
int describeContents ()

描述此Parcelable实例的封送表示中包含的特殊对象的种类。 例如,如果对象将在writeToParcel(Parcel, int)的输出中包含writeToParcel(Parcel, int) ,则此方法的返回值必须包含CONTENTS_FILE_DESCRIPTOR位。

Returns
int a bitmask indicating the set of special object types marshaled by this Parcelable object instance.

getExtras

Added in API level 23
Bundle getExtras ()

返回与此选项关联的所有可选附加信息,如果没有,则返回null。 请注意,此方法会返回对该选件中实际附加套件的引用,因此对其进行的修改将直接修改选件中的附加功能。

Returns
Bundle

getIndex

Added in API level 23
int getIndex ()

返回构造函数中提供的索引。 如果选项没有索引,则返回-1。

Returns
int

getLabel

Added in API level 23
CharSequence getLabel ()

Returns
CharSequence

getSynonymAt

Added in API level 23
CharSequence getSynonymAt (int index)

Parameters
index int
Returns
CharSequence

setExtras

Added in API level 23
void setExtras (Bundle extras)

设置与此选项关联的可选附加信息。 请注意,此方法取得了所提供的附加软件包的所有权。

Parameters
extras Bundle

writeToParcel

Added in API level 23
void writeToParcel (Parcel dest, 
                int flags)

将此对象平铺到一个包裹中。

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

Hooray!