How to clear focused Edit text 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 am only able to delete upto One character only, Is there any way I can delete/clear the focused Edit text.
This works for me:
function clear_input() {
adb shell input keyevent KEYCODE_MOVE_END
adb shell input keyevent --longpress $(printf 'KEYCODE_DEL %.0s' {1..250})
}
Then:
clear_input