Search code examples
androidinputmonkeyrunner

How to perform tap hold on android?


I'm trying to script a tap and hold on an Android device and I haven't worked out how.

I tried playing with the input command options but couldn't find anything relating to holding.

I've also looked at MonkeyRunner and could succesfully get the desired effect from a computer with the Android device connected, but couldn't run monkeyrunner on the device itself, without a computer.

Is there a way to script a tap and hold/tap down only/long tap on an Android device (I'm just using the shell for now) ? If so how ?


Solution

  • There are several ways to inject events. You can use Robotium or Monkeyrunner for testing. Or you can try to inject events directly this way.