直接前往內容

最常造訪的網頁

最近瀏覽的網頁

navigation

VoiceInteractor.PickOptionRequest

public static class VoiceInteractor.PickOptionRequest
extends VoiceInteractor.Request

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


Select a single option from multiple potential options with the user via the trusted system VoiceInteractionService. Typically, the application would present this visually as a list view to allow selecting the option by touch. The result of the confirmation will be returned through an asynchronous call to either onPickOptionResult(boolean, VoiceInteractor.PickOptionRequest.Option[], Bundle) or onCancel() - these methods should be overridden to define the application specific behavior.

Summary

Nested classes

class VoiceInteractor.PickOptionRequest.Option

Represents a single option that the user may select using their voice. 

Public constructors

VoiceInteractor.PickOptionRequest(VoiceInteractor.Prompt prompt, Option[] options, Bundle extras)

Create a new pick option request.

Public methods

void onPickOptionResult(boolean finished, Option[] selections, Bundle result)

Called when a single option is confirmed or narrowed to one of several options.

Inherited methods

Public constructors

VoiceInteractor.PickOptionRequest

added in API level 23
VoiceInteractor.PickOptionRequest (VoiceInteractor.Prompt prompt, 
                Option[] options, 
                Bundle extras)

Create a new pick option request.

Parameters
prompt VoiceInteractor.Prompt: Optional question to be asked of the user when the options are presented or null if nothing should be asked.

options Option: The set of VoiceInteractor.PickOptionRequest.Options the user is selecting from.

extras Bundle: Additional optional information or null.

Public methods

onPickOptionResult

added in API level 23
void onPickOptionResult (boolean finished, 
                Option[] selections, 
                Bundle result)

Called when a single option is confirmed or narrowed to one of several options. Override this method to define the behavior when the user selects an option or narrows down the set of options.

Parameters
finished boolean: True if the voice interaction has finished making a selection, in which case selections contains the final result. If false, this request is still active and you will continue to get calls on it.

selections Option: Either a single VoiceInteractor.PickOptionRequest.Option or one of several VoiceInteractor.PickOptionRequest.Options the user has narrowed the choices down to.

result Bundle: Additional optional information.

本網站使用 Cookie 儲存你在此指定的語言和顯示選項偏好設定。

掌握有關 Android 開發人員的最新消息和實用訣竅,協助你製作最受歡迎的 Google Play 內容。

* 必填欄位

訂閱成功!

在 WeChat 上追蹤 Google Developers

你要以瀏覽這個網站嗎?

你要求以顯示這個網頁,但你為此網站指定的語言偏好設定為

是否要變更語言偏好設定並改用瀏覽網站?稍後如要變更語言偏好設定,請利用位在每個網頁最下方的語言選單來調整設定。

你的 API 層級必須達 以上才能存取這個級別

本說明文件已隱藏,因為你為該文件選取的 API 層級為 。使用左側導覽列上方的選取工具即可變更說明文件的 API 層級。

如需進一步瞭解如何為應用程式指定 API 層級的相關資訊,請參閱 Supporting Different Platform Versions (支援不同的平台版本) (英文)。

Take a short survey?
Help us improve the Android developer experience. (April 2018 — Developer Survey)