I know how to \"synthesize\" a MotionEvent:
event = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_DOWN, x, y, 0);
What I am
What you are trying to do is perfectly possible and simple:
void simulateEventDown( View v, long x, long y )
{
MotionEvent e = MotionEvent.obtain( SystemClock.uptimeMillis(),
SystemClock.uptimeMillis(),
MotionEvent.ACTION_DOWN,
x, y, 0);
v.dispatchTouchEvent(e);
}
No, it's prevented by design. The concern is that such a feature can be used to subvert the entire security model - e.g. by "injecting" touches to contact the marketplace, arrange an install, accept the security warnings .. all on its own.
This has been discussed at some length here and following.
If this answers your question, kindly click the checkmark to the left - thanks!