Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to simulate a click on the screen in Android? [duplicate]

Is it possible to simulate a "click" (touch screen) by coordinates or on a view element?

like image 243
TyrionLannister Avatar asked Mar 24 '23 21:03

TyrionLannister


1 Answers

It is possible to simulate touch events on android screen. If you have the coordinates of the view then you can generate touch events by using adb shell commands. For e.g-

adb shell input tap x y

where x and y are your coordinates. You can run this command from terminal. If you want to run the command from android code then use "/system/bin/ input tap x y" and run this by using Runtime.getRuntime() method. For details please reply, happy to help! :)

like image 127
suv Avatar answered Apr 25 '23 06:04

suv