RemoteInputIntent

public class RemoteInputIntent
extends Object

java.lang.Object
   ↳ android.support.wearable.input.RemoteInputIntent


通过启动 Intent来支持远程输入的 Intent

以下示例通过启动输入活动提示用户为一个 RemoteInput提供输入。

 public static final String KEY_QUICK_REPLY_TEXT = "quick_reply";
 RemoteInput[] remoteInputs = new RemoteInput[] {
     new RemoteInput.Builder(KEY_QUICK_REPLY_TEXT).setLabel("Quick reply").build()
 };
 Intent intent = new Intent(ACTION_REMOTE_INPUT);
 intent.putExtra(EXTRA_REMOTE_INPUTS, remoteInputs);
 startActivity(intent);
 

通过onActivityResult(int, int, Intent)返回的意图将包含收集到的输入结果。 要访问这些结果,请使用getResultsFromIntent(Intent)函数。 结果值将显示在传递给构造函数RemoteInput.Builder的结果键下。

 public static final String KEY_QUICK_REPLY_TEXT = "quick_reply";
 Bundle results = RemoteInput.getResultsFromIntent(intent);
 if (results != null) {
     CharSequence quickReplyResult = results.getCharSequence(KEY_QUICK_REPLY_TEXT);
 }

Summary

Constants

String ACTION_REMOTE_INPUT

开始一个活动,该活动将根据 RemoteInput提示用户输入。

String EXTRA_CANCEL_LABEL

显示可选字符串以取消操作。

String EXTRA_CONFIRM_LABEL

显示可选字符串以确认应执行操作。

String EXTRA_IN_PROGRESS_LABEL

可穿戴设备准备自动执行操作时显示的可选字符串。

String EXTRA_REMOTE_INPUTS

的阵列 RemoteInput ,与其一起使用 ACTION_REMOTE_INPUT ,指定要从用户收集输入。

String EXTRA_SKIP_CONFIRMATION_UI

可选布尔值,与 ACTION_REMOTE_INPUT一起使用,用于指示在用户输入输入后是否应向用户显示确认屏幕。

String EXTRA_TITLE

显示在确认屏幕顶部的字符串,用于描述“SMS”或“电子邮件”等操作。

Public constructors

RemoteInputIntent()

Inherited methods

From class java.lang.Object

Constants

ACTION_REMOTE_INPUT

String ACTION_REMOTE_INPUT

开始一个活动,该活动将提示用户输入基于RemoteInput输入。 结果将通过活动结果( onActivityResult(int, int, Intent) 。为了检索用户的输入,应该调用getResultsFromIntent(Intent)以获取包含由远程输入收集器填充的每个结果键的键/值的包。

使用此操作时,应该使用 EXTRA_REMOTE_INPUTS的数组填充额外的 RemoteInput

常量值:“android.support.wearable.input.action.REMOTE_INPUT”

EXTRA_CANCEL_LABEL

String EXTRA_CANCEL_LABEL

显示可选字符串以取消操作。 这通常是命令式动词,如“取消”。 默认为取消。

常量值:“android.support.wearable.input.extra.CANCEL_LABEL”

EXTRA_CONFIRM_LABEL

String EXTRA_CONFIRM_LABEL

显示可选字符串以确认应执行操作。 这通常是命令式动词,如“发送”。 默认为“发送”。

常量值:“android.support.wearable.input.extra.CONFIRM_LABEL”

EXTRA_IN_PROGRESS_LABEL

String EXTRA_IN_PROGRESS_LABEL

可穿戴设备准备自动执行操作时显示的可选字符串。 这通常是一个'ing'动词,以省略号结尾,如“正在发送...”。 默认为“正在发送...”。

常量值:“android.support.wearable.input.extra.IN_PROGRESS_LABEL”

EXTRA_REMOTE_INPUTS

String EXTRA_REMOTE_INPUTS

的阵列 RemoteInput ,与其一起使用 ACTION_REMOTE_INPUT ,指定要从用户收集输入。

常量值:“android.support.wearable.input.extra.REMOTE_INPUTS”

EXTRA_SKIP_CONFIRMATION_UI

String EXTRA_SKIP_CONFIRMATION_UI

可选布尔值,与ACTION_REMOTE_INPUT一起使用,用于指示在用户输入输入后是否应向用户显示确认屏幕。 默认值为true,表示在通过活动结果返回结果之前,会向用户显示确认屏幕。

常量值:“android.support.wearable.input.extra.SKIP_CONFIRMATION_UI”

EXTRA_TITLE

String EXTRA_TITLE

显示在确认屏幕顶部的字符串,用于描述“SMS”或“电子邮件”等操作。

常量值:“android.support.wearable.input.extra.TITLE”

Public constructors

RemoteInputIntent

RemoteInputIntent ()