# VoiceInteractor.AbortVoiceRequest

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

# AbortVoiceRequest

*** ** * ** ***

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

```
class AbortVoiceRequest : VoiceInteractor.Request
```

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

Reports that the current interaction can not be complete with voice, so the application will need to switch to a traditional input UI. Applications should only use this when they need to completely bail out of the voice interaction and switch to a traditional UI. When the response comes back, the voice system has handled the request and is ready to switch; at that point the application can start a new non-voice activity. Be sure when starting the new activity to use [Intent.FLAG_ACTIVITY_NEW_TASK](https://developer.android.com/reference/kotlin/android/content/Intent.html#FLAG_ACTIVITY_NEW_TASK:kotlin.Int) to keep the new activity out of the current voice interaction task.

## Summary

|                                                                                                                                                                                                                     Public constructors                                                                                                                                                                                                                      ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [AbortVoiceRequest](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.AbortVoiceRequest#AbortVoiceRequest(android.app.VoiceInteractor.Prompt,%20android.os.Bundle))`(`prompt:` `[VoiceInteractor.Prompt](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.Prompt)?`, `extras:` `[Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)?`)` Create a new voice abort request. |

|                                                                                                                                                              Public methods                                                                                                                                                               ||
|-----------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onAbortResult](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.AbortVoiceRequest#onAbortResult(android.os.Bundle))`(`result:` `[Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)!`)` <br /> |

| Inherited functions ||
|---|---|
| From class [Request](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.Request) |------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)             | [cancel](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.Request#cancel())`()` Cancel this active request. <br />                                                                                                                                                                                                                                                 | | [Activity](https://developer.android.com/reference/kotlin/android/app/Activity)!         | [getActivity](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.Request#getActivity())`()` Return the current [Activity](https://developer.android.com/reference/kotlin/android/app/Activity) this request is associated with. Will change if the activity is restarted such as through a configuration change. <br />                                              | | [Context](https://developer.android.com/reference/kotlin/android/content/Context.html#)! | [getContext](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.Request#getContext())`()` Return the current [Context](https://developer.android.com/reference/kotlin/android/content/Context.html#) this request is associated with. May change if the activity hosting it goes through a configuration change. <br />                                              | | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!        | [getName](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.Request#getName())`()` Return the name this request was submitted through [submitRequest(android.app.VoiceInteractor.Request,java.lang.String)](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor#submitRequest(android.app.VoiceInteractor.Request,%20kotlin.String)). <br /> | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)             | [onAttached](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.Request#onAttached(android.app.Activity))`(`activity:` `[Activity](https://developer.android.com/reference/kotlin/android/app/Activity)!`)` The request is now attached to an activity, or being re-attached to a new activity after a configuration change. <br />                                  | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)             | [onCancel](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.Request#onCancel())`()` Report from voice interaction service: this operation has been canceled, typically as a completion of a previous call to [cancel](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.Request#cancel()) or when the user explicitly cancelled. <br />   | | [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html)             | [onDetached](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.Request#onDetached())`()` The request is being detached from an activity. <br />                                                                                                                                                                                                                     | | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)         | [toString](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.Request#toString())`()` <br />                                                                                                                                                                                                                                                                         | ||

## Public constructors

### AbortVoiceRequest

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

```
AbortVoiceRequest(
    prompt: VoiceInteractor.Prompt?, 
    extras: Bundle?)
```

Create a new voice abort request.

|                                                                                                                         Parameters                                                                                                                         ||
|----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `prompt` | [VoiceInteractor.Prompt](https://developer.android.com/reference/kotlin/android/app/VoiceInteractor.Prompt)?: Optional message to speak to the user indicating why the task could not be completed by voice or null if nothing should be spoken. |
| `extras` | [Bundle](https://developer.android.com/reference/kotlin/android/os/Bundle.html#)?: Additional optional information or null.                                                                                                                      |

## Public methods

### onAbortResult

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

```
open fun onAbortResult(result: Bundle!): Unit
```