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.
The only way that I have found so far is to get the proper coordinates to use
input swipe x y x y durationto simulate a long press. This will then highlight all the text in the EditText field. You can then send the keys you want to replace what was there.I just wish that
adb shell input keyevent KEYCODE_CLEARwould clear all the text in the field. That would make things so much easier, if someone can find a better way that would be great.