Last active
November 21, 2020 11:00
-
-
Save mrvivacious/12d07fbf2c84bf858f06746d445dbb2c to your computer and use it in GitHub Desktop.
Paste text in an accessibility node on Android
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // For Android | |
| // Class must extend AccessibilityService to use this function verbatim | |
| // Have fun | |
| // Function will overwrite any existing text in the node | |
| public void setText(AccessibilityNodeInfo node, String textToSet) { | |
| Bundle arguments = new Bundle(); | |
| arguments.putCharSequence(AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, | |
| textToSet); | |
| node.performAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_SET_TEXT.getId(), arguments); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment