I have tried following code snippet to execute the batch of command for sendevent to click the coordinate 44,129 on the emulator. But it is not showing any result. But if i am giving the same batch of command to the shell prompt it is able to click the mentioned coordinate succesfully.
String[] cmmandemulatorarr = {"/system/bin/sendevent /dev/input/event0 3 0 44", "/system/bin/sendevent /dev/input/event0 3 1 129", "/system/bin/sendevent /dev/input/event0 1 330 1", "/system/bin/sendevent /dev/input/event0 0 0 0", "/system/bin/sendevent /dev/input/event0 1 330 0", "/system/bin/sendevent /dev/input/event0 0 0 0", };
for (int i = 0; i < cmmandemulatorarr.length; i++) {
Process process =
Runtime.getRuntime().exec(cmmandemulatorarr[i]);
BufferedReader reader = new BufferedReader(
new InputStreamReader(process.getInputStream()));
int read;
char[] buffer = new char[4096];
StringBuffer output = new StringBuffer();
while ((read = reader.read(buffer)) > 0) {
output.append(buffer, 0, read);
}
reader.close();
}
} catch (IOException e) {
throw new RuntimeException(e);
}
Is there is anything i am missing here or i have to try something else to get click event on some coordinate through the code.
Note :: I am not getting any exception in the log while executing the code which seems that command is executed successfully.
Regards Pinu