How to clear focused text editing using shell command.
I tried
adb shell input keyevent KEYCODE_CLEAR // Not worked adb shell input keyevent KEYCODE_DEL // Delete only one char adb shell input keyevent KEYCODE_FORWARD_DEL // Not worked
With this, I can only delete only one character, is there any way to remove / clear focused editing text.
This works for me:
function android_clear_input { adb shell input keyevent KEYCODE_MOVE_END for i in $(seq 50); do adb shell input keyevent KEYCODE_DEL done }
Then:
android_clear_input
If you use uiautomator ( https://github.com/xiaocong/uiautomator ), you can do this:
tap the EditText widget to get focus, then
use device(focused=True).clear_text()to clear the view, or device(focused=True).set_text("new text")to set new text.
device(focused=True).clear_text()
device(focused=True).set_text("new text")
, , - input swipe x y x y duration . EditText. , , .
input swipe x y x y duration
, adb shell input keyevent KEYCODE_CLEAR . , - , .
adb shell input keyevent KEYCODE_CLEAR
, , :
mEditText.setOnKeyListener(new View.OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (KeyEvent.KEYCODE_CLEAR == keyCode) { mEditText.setText(""); } return true; } });
Source: https://habr.com/ru/post/1606211/More articles:EasyZip generated zip not working properly - angularjsCommon type restriction - genericsA blank or empty text field instead of a null value - javascripthttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1606209/json-request-was-too-larget-to-be-deserialized&usg=ALkJrhjtl9SgWGprAtRwuAm0FtXB4km4Twthere is no phpmyadmin.conf in / etc / apache2 / conf-available / phpmyadmin - ubuntuC ++ 11 standard initialization: field initializer is not constant - c ++How to raise INPUT FILE REACTJS event to another DOM - javascriptКопирование файлов из одной папки в другую папку в s3 того же ведра NODE JS - javascriptНесколько версий Virtualbox на Yosemite - virtualboxCron expression to perform a task twice a day at different times? - cronAll Articles