共用方式為


IInputConnection.CommitContent Method

Definition

Called by the input method to commit content such as a PNG image to the editor.

[Android.Runtime.Register("commitContent", "(Landroid/view/inputmethod/InputContentInfo;ILandroid/os/Bundle;)Z", "GetCommitContent_Landroid_view_inputmethod_InputContentInfo_ILandroid_os_Bundle_Handler:Android.Views.InputMethods.IInputConnectionInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=25)]
public bool CommitContent (Android.Views.InputMethods.InputContentInfo inputContentInfo, Android.Views.InputMethods.InputContentFlags flags, Android.OS.Bundle? opts);
[<Android.Runtime.Register("commitContent", "(Landroid/view/inputmethod/InputContentInfo;ILandroid/os/Bundle;)Z", "GetCommitContent_Landroid_view_inputmethod_InputContentInfo_ILandroid_os_Bundle_Handler:Android.Views.InputMethods.IInputConnectionInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=25)>]
abstract member CommitContent : Android.Views.InputMethods.InputContentInfo * Android.Views.InputMethods.InputContentFlags * Android.OS.Bundle -> bool

Parameters

inputContentInfo
InputContentInfo

Content to be inserted.

flags
InputContentFlags

#INPUT_CONTENT_GRANT_READ_URI_PERMISSION if the content provider allows android.R.styleable#AndroidManifestProvider_grantUriPermissions grantUriPermissions or 0 if the application does not need to call InputContentInfo#requestPermission().

opts
Bundle

optional bundle data. This can be null.

Returns

true if this request is accepted by the application, whether the request is already handled or still being handled in background, false otherwise.

Attributes

Remarks

Called by the input method to commit content such as a PNG image to the editor.

In order to avoid a variety of compatibility issues, this focuses on a simple use case, where editors and IMEs are expected to work cooperatively as follows:

<ul> <li>Editor must keep EditorInfo#contentMimeTypes equal to null if it does not support this method at all.</li> <li>Editor can ignore this request when the MIME type specified in inputContentInfo does not match any of EditorInfo#contentMimeTypes. </li> <li>Editor can ignore the cursor position when inserting the provided content.</li> <li>Editor can return true asynchronously, even before it starts loading the content.</li> <li>Editor should provide a way to delete the content inserted by this method or to revert the effect caused by this method.</li> <li>IME should not call this method when there is any composing text, in case calling this method causes a focus change.</li> <li>IME should grant a permission for the editor to read the content. See EditorInfo#packageName about how to obtain the package name of the editor.</li> </ul>

Java documentation for android.view.inputmethod.InputConnection.commitContent(android.view.inputmethod.InputContentInfo, int, android.os.Bundle).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to