android - Tap Input Emulation Programmatically -
i trying make service emulate tap input, isn't working.
my main activity called
try { runtime.getruntime().exec("su"); } catch (ioexception e) { e.printstacktrace(); }
my service checks if toggle button clicked want call
try { runtime.getruntime().exec("input tap" + main.xvalue.tostring() + main.yvalue.tostring()); } catch (ioexception e) { e.printstacktrace(); }
but no success, explain why?
as example lets say: main.xvalue.tostring() = 10
main.yvalue.tostring() = 20
so according code, line :
"input tap" + main.xvalue.tostring() + main.yvalue.tostring()
will "input tap1020"
but expect "input tap 10 20" !
try :
try { runtime.getruntime().exec("su -c input tap " + main.xvalue.tostring() + " " + main.yvalue.tostring()); } catch (ioexception e) { e.printstacktrace(); }
Comments
Post a Comment