RemoteInput 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
物件 RemoteInput 指定要從使用者那裡收集輸入,並 android.app.PendingIntent 傳遞一個意圖,並傳送出一個意圖。
[Android.Runtime.Register("android/app/RemoteInput", DoNotGenerateAcw=true)]
public sealed class RemoteInput : Java.Lang.Object, Android.OS.IParcelable, IDisposable, Java.Interop.IJavaPeerable
[<Android.Runtime.Register("android/app/RemoteInput", DoNotGenerateAcw=true)>]
type RemoteInput = class
inherit Object
interface IParcelable
interface IJavaObject
interface IDisposable
interface IJavaPeerable
- 繼承
- 屬性
- 實作
備註
物件 RemoteInput 指定要從使用者那裡收集輸入,並 android.app.PendingIntent 傳遞一個意圖,並傳送出一個意圖。 一定要用 RemoteInput.Builder 來建立這個類別的實例。
請參閱 回覆通知一節 ,了解如何使用此類別。
以下範例將 a RemoteInput 加入 Notification.Action,將結果鍵設為 quick_reply,並將標籤設為 Quick reply。 使用者在觸發動作時會被提示輸入回應。 結果會隨意圖一併傳送,並可利用提供給 Builder 建構子的結果鍵從由 返回 #getResultsFromIntent的 Bundle 中取得。
public static final String KEY_QUICK_REPLY_TEXT = "quick_reply";
Notification.Action action = new Notification.Action.Builder(
R.drawable.reply, "Reply", actionIntent)
<b>.addRemoteInput(new RemoteInput.Builder(KEY_QUICK_REPLY_TEXT)
.setLabel("Quick reply").build()</b>)
.build();
當 發動時 android.app.PendingIntent ,若收集到,內部的意圖會包含輸入結果。 要取得這些結果,請使用該 #getResultsFromIntent 函數。 結果值會顯示在傳給 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);
}
Java 文件 android.app.RemoteInput。
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。
欄位
| 名稱 | Description |
|---|---|
| EditChoicesBeforeSendingAuto |
已淘汰.
平台會決定選項是否會被編輯,然後才會送入應用程式。 |
| EditChoicesBeforeSendingDisabled |
已淘汰.
點擊選項應該會立即傳送輸入,不會讓使用者自行編輯。 |
| EditChoicesBeforeSendingEnabled |
已淘汰.
點擊選項應該能讓使用者在輸入送到應用程式前編輯。 |
| ExtraResultsData |
額外新增在剪輯資料意圖物件中,用來存放文字結果包。 |
| ResultsClipLabel |
標籤用來表示用於遠端輸入傳輸的剪輯資料類型 |
| SourceChoice |
已淘汰.
使用者從 |
| SourceFreeFormInput |
已淘汰.
使用者手動輸入資料。 |
屬性
| 名稱 | Description |
|---|---|
| AllowedDataTypes |
取得可能的非文字輸入,且這些輸入被接受。 |
| AllowFreeFormInput |
了解使用者是否能為輸入提供任意值。 |
| Class |
回傳此 |
| Creator | |
| EditChoicesBeforeSending |
判斷點擊選項是否應該讓使用者在輸入輸入前編輯。 |
| Extras |
透過這個遠端輸入,讓更多元資料得以攜帶。 |
| Handle |
底層 Android 實例的帳號。 (繼承來源 Object) |
| IsDataOnly |
若輸入只接受資料,則回傳真值,表示 |
| JniIdentityHashCode |
物件 |
| JniPeerMembers |
物件 |
| Label |
物件 |
| LabelFormatted |
讓標籤在收集這些輸入時顯示給使用者。 |
| PeerReference |
物件 |
| ResultKey |
取得該輸入結果將從 Bundle 中設定的密鑰,該 Bundle |
| ThresholdClass |
此 API 支援 Mono for Android 基礎架構,並非直接從你的程式碼中使用。 (繼承來源 Object) |
| ThresholdType |
此 API 支援 Mono for Android 基礎架構,並非直接從你的程式碼中使用。 (繼承來源 Object) |
方法
| 名稱 | Description |
|---|---|
| AddDataResultToIntent(RemoteInput, Intent, IDictionary<String,Uri>) |
和設定資料結果一樣 |
| AddResultsToIntent(RemoteInput[], Intent, Bundle) |
將從遠端輸入取得的文字結果填入意圖物件。 |
| Clone() |
建立並回傳此物件的副本。 (繼承來源 Object) |
| DescribeContents() |
描述此 Parcelable 的組建表示中包含的特殊物件種類。 |
| Dispose() |
物件 |
| Dispose(Boolean) |
物件 |
| Equals(Object) |
表示是否有其他物體「等同」於此物。 (繼承來源 Object) |
| GetChoices() |
取得可能的輸入選項。 |
| GetChoicesFormatted() |
取得可能的輸入選項。 |
| GetDataResultsFromIntent(Intent, String) |
類似於 |
| GetHashCode() |
回傳物件的雜湊碼值。 (繼承來源 Object) |
| GetResultsFromIntent(Intent) |
從意圖中取得遠端輸入文字結果組合。 |
| GetResultsSource(Intent) |
取得 RemoteInput 結果的來源。 |
| JavaFinalize() |
當垃圾回收判定該物件不再有相關參考時,由垃圾回收器呼叫。 (繼承來源 Object) |
| Notify() |
喚醒一個正在該物件監視器上等待的執行緒。 (繼承來源 Object) |
| NotifyAll() |
喚醒所有等待該物件監視器的執行緒。 (繼承來源 Object) |
| SetHandle(IntPtr, JniHandleOwnership) |
設定 Handle 屬性。 (繼承來源 Object) |
| SetResultsSource(Intent, RemoteInputSource) |
設定 RemoteInput 結果的來源。 |
| ToArray<T>() |
物件 |
| ToString() |
回傳物件的字串表示。 (繼承來源 Object) |
| UnregisterFromRuntime() |
物件 |
| Wait() |
導致目前執行緒等待被喚醒,通常是透過 <em>通知</><em 或 em>中斷</em> 來喚醒。 (繼承來源 Object) |
| Wait(Int64, Int32) |
會讓目前執行緒等待喚醒,通常是透過 <em>通知</><em 或 em>中斷</em>,或是經過一定的真實時間。 (繼承來源 Object) |
| Wait(Int64) |
會讓目前執行緒等待喚醒,通常是透過 <em>通知</><em 或 em>中斷</em>,或是經過一定的真實時間。 (繼承來源 Object) |
| WriteToParcel(Parcel, ParcelableWriteFlags) |
把這個物體壓扁成一個包裹。 |
明確介面實作
| 名稱 | Description |
|---|---|
| IJavaPeerable.Disposed() |
物件 |
| IJavaPeerable.DisposeUnlessReferenced() |
物件 |
| IJavaPeerable.Finalized() |
物件 |
| IJavaPeerable.JniManagedPeerState |
物件 |
| IJavaPeerable.SetJniIdentityHashCode(Int32) |
物件 |
| IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) |
物件 |
| IJavaPeerable.SetPeerReference(JniObjectReference) |
物件 |
擴充方法
| 名稱 | Description |
|---|---|
| GetJniTypeName(IJavaPeerable) |
取得實例 |
| JavaAs<TResult>(IJavaPeerable) |
試著強制 |
| JavaCast<TResult>(IJavaObject) |
執行 Android 執行時檢查型別轉換。 |
| JavaCast<TResult>(IJavaObject) |
物件 |
| TryJavaCast<TResult>(IJavaPeerable, TResult) |
試著強制 |