# VoiceInteractor.PickOptionRequest.Option

Added in[API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Option

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/app/VoiceInteractor.PickOptionRequest.Option "View this page in Java")  

```
class Option : Parcelable
```

|---|--------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                               ||
| ↳ | [android.app.VoiceInteractor.PickOptionRequest.Option](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.PickOptionRequest.Option#) |

Represents a single option that the user may select using their voice. The[getIndex()](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.PickOptionRequest.Option#getIndex())method should be used as a unique ID to identify the option when it is returned from the voice interactor.

## Summary

| Inherited constants ||
|---|---|
| From class[Parcelable](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#) |----------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [CONTENTS_FILE_DESCRIPTOR](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#CONTENTS_FILE_DESCRIPTOR:kotlin.Int) <br /> Descriptor bit used with[describeContents()](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#describeContents()): indicates that the Parcelable object's flattened representation includes a file descriptor. <br />                                                                                                                                                                                                        | | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE:kotlin.Int) <br /> Flag for use with[writeToParcel](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#writeToParcel(android.os.Parcel,%20kotlin.Int)): the object being written is a return value, that is the result of a function such as "`Parcelable someFunction()`", "`void someFunction(out Parcelable)`", or "`void someFunction(inout Parcelable)`". Some implementations may want to release resources at this point. <br /> | ||

|                                                                                                                                                                                                                            Public constructors                                                                                                                                                                                                                             ||
|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [Option](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.PickOptionRequest.Option#Option(kotlin.CharSequence,%20kotlin.Int))`(`label:` `[CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)!`, `index:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` 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](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.PickOptionRequest.Option#)! | [addSynonym](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.PickOptionRequest.Option#addSynonym(kotlin.CharSequence))`(`synonym:` `[CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)!`)` Add a synonym term to the option to indicate an alternative way the content may be matched.    |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                                                                        | [countSynonyms](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.PickOptionRequest.Option#countSynonyms())`()` <br />                                                                                                                                                                                                                 |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                                                                        | [describeContents](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.PickOptionRequest.Option#describeContents())`()` <br />                                                                                                                                                                                                           |
| [Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)!                                                                 | [getExtras](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.PickOptionRequest.Option#getExtras())`()` Return any optional extras information associated with this option, or null if there is none.                                                                                                                                  |
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)                                                                        | [getIndex](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.PickOptionRequest.Option#getIndex())`()` Return the index that was supplied in the constructor.                                                                                                                                                                           |
| [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)!                                                    | [getLabel](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.PickOptionRequest.Option#getLabel())`()` <br />                                                                                                                                                                                                                           |
| [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)!                                                    | [getSynonymAt](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.PickOptionRequest.Option#getSynonymAt(kotlin.Int))`(`index:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` <br />                                                                                                                    |
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                      | [setExtras](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.PickOptionRequest.Option#setExtras(android.os.Bundle))`(`extras:` `[Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)!`)` Set optional extra information associated with this option.                                                      |
| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)                                                                      | [writeToParcel](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.PickOptionRequest.Option#writeToParcel(android.os.Parcel,%20kotlin.Int))`(`dest:` `[Parcel](https://developer.android.com/reference/kotlin/android/os/Parcel.html#)`, `flags:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` <br /> |

|                                                                                                                                                                                                            Properties                                                                                                                                                                                                            ||
|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------|
| static[Parcelable.Creator](https://developer.android.com/reference/kotlin/android/os/Parcelable.Creator.html#)\<[VoiceInteractor.PickOptionRequest.Option](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.PickOptionRequest.Option#)!\> | [CREATOR](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.PickOptionRequest.Option#CREATOR:android.os.Parcelable.Creator) <br /> |

## Public constructors

### Option

Added in[API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
Option(
    label: CharSequence!, 
    index: Int)
```

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

|                                                                                                                Parameters                                                                                                                 ||
|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `label` | [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)!:The label that will both be matched against what the user speaks and displayed visually.                                          |
| `index` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):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](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun addSynonym(synonym: CharSequence!): VoiceInteractor.PickOptionRequest.Option!
```

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

|                                                                                         Parameters                                                                                          ||
|-----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `synonym` | [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)!:The synonym that will be matched against what the user speaks, but not displayed. |

### countSynonyms

Added in[API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun countSynonyms(): Int
```  

### describeContents

Added in[API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun describeContents(): Int
```

|                                                                                                                                                                               Return                                                                                                                                                                               ||
|----------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | 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](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#CONTENTS_FILE_DESCRIPTOR:kotlin.Int) |

### getExtras

Added in[API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getExtras(): Bundle!
```

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.  

### getIndex

Added in[API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getIndex(): Int
```

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

### getLabel

Added in[API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getLabel(): CharSequence!
```  

### getSynonymAt

Added in[API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun getSynonymAt(index: Int): CharSequence!
```  

### setExtras

Added in[API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun setExtras(extras: Bundle!): Unit
```

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

### writeToParcel

Added in[API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
fun writeToParcel(
    dest: Parcel, 
    flags: Int
): Unit
```

|                                                                                                                                                                                                                                                                                     Parameters                                                                                                                                                                                                                                                                                     ||
|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `dest`  | [Parcel](https://developer.android.com/reference/kotlin/android/os/Parcel.html#):The Parcel in which the object should be written. This value cannot be`null`.                                                                                                                                                                                                                                                                                                                                                                                                            |
| `flags` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Additional flags about how the object should be written. May be 0 or[PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE:kotlin.Int). Value is either`0`or a combination of[android.os.Parcelable#PARCELABLE_WRITE_RETURN_VALUE](https://developer.android.com/reference/kotlin/android/os/Parcelable.html#PARCELABLE_WRITE_RETURN_VALUE:kotlin.Int), and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |

## Properties

### CREATOR

Added in[API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val CREATOR: Parcelable.Creator<VoiceInteractor.PickOptionRequest.Option!>
```