{% setvar book_path %}/reference/androidx/_book.yaml{% endsetvar %} {% include "_shared/_reference-head-tags.html" %}

TextActionsKt

public final class TextActionsKt


Summary

Public methods

static final void

Sends to this node the IME action associated with it in a similar way to the IME.

static final void

Clears the text in this node in similar way to IME.

static final void

Sends the given text to this node in similar way to IME.

static final void

Sends the given selection to this node in similar way to IME.

static final void

Replaces existing text with the given text in this node in similar way to IME.

Public methods

performImeAction

public static final void performImeAction(@NonNull SemanticsNodeInteraction receiver)

Sends to this node the IME action associated with it in a similar way to the IME.

The node needs to define its IME action in semantics via SemanticsPropertyReceiver.performImeAction.

Throws
kotlin.AssertionError

if the node does not support input or does not define IME action.

kotlin.IllegalStateException

if the node did is not an editor or would not be able to establish an input connection (e.g. does not define ImeAction or PerformImeAction or is not focused).

performTextClearance

public static final void performTextClearance(@NonNull SemanticsNodeInteraction receiver)

Clears the text in this node in similar way to IME.

performTextInput

public static final void performTextInput(
    @NonNull SemanticsNodeInteraction receiver,
    @NonNull String text
)

Sends the given text to this node in similar way to IME.

Parameters
@NonNull String text

Text to send.

performTextInputSelection

@ExperimentalTestApi
public static final void performTextInputSelection(
    @NonNull SemanticsNodeInteraction receiver,
    @NonNull TextRange selection
)

Sends the given selection to this node in similar way to IME.

Parameters
@NonNull TextRange selection

selection to send

performTextReplacement

public static final void performTextReplacement(
    @NonNull SemanticsNodeInteraction receiver,
    @NonNull String text
)

Replaces existing text with the given text in this node in similar way to IME.

This does not reflect text selection. All the text gets cleared out and new inserted.

Parameters
@NonNull String text

Text to send.