InputConnectionWrapper.TakeSnapshot Method

Definition

Called by the system when it needs to take a snapshot of multiple text-related data in an atomic manner.

[Android.Runtime.Register("takeSnapshot", "()Landroid/view/inputmethod/TextSnapshot;", "GetTakeSnapshotHandler", ApiSince=34)]
public virtual Android.Views.InputMethods.TextSnapshot? TakeSnapshot ();
[<Android.Runtime.Register("takeSnapshot", "()Landroid/view/inputmethod/TextSnapshot;", "GetTakeSnapshotHandler", ApiSince=34)>]
abstract member TakeSnapshot : unit -> Android.Views.InputMethods.TextSnapshot
override this.TakeSnapshot : unit -> Android.Views.InputMethods.TextSnapshot

Returns

null if TextSnapshot is unavailable and/or this API is called from IMEs. Beware the bug in older devices mentioned above.

Implements

Attributes

Remarks

Called by the system when it needs to take a snapshot of multiple text-related data in an atomic manner.

<strong>Editor authors</strong>: Supporting this method is strongly encouraged. Atomically taken TextSnapshot is going to be really helpful for the system when optimizing IPCs in a safe and deterministic manner. Return null if an atomically taken TextSnapshot is unavailable. The system continues supporting such a scenario gracefully.

<strong>IME authors</strong>: Currently IMEs cannot call this method directly and always receive null as the result.

Beware that there is a bug that this method was not overridden in InputConnectionWrapper, which ended up always returning null when gets called even if the wrapped InputConnection implements this method. The bug was fixed in android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE.

Java documentation for android.view.inputmethod.InputConnectionWrapper.takeSnapshot().

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