3

I'm creating an Android App for a TV platform with a webview, and I'm trying to provide a mouse mode where the user can move a cursor around with the DPAD. Everything up to that works fine so far, but I cannot figure out how to click in the webview. I'm trying to send a MotionEvent:

MotionEvent downEvent = MotionEvent.obtain(SystemClock.uptimeMillis(), SystemClock.uptimeMillis(), MotionEvent.ACTION_DOWN, xPosition, yPosition, 0);
downEvent.setSource(InputDevice.SOURCE_MOUSE);
mWebView.dispatchTouchEvent(downEvent);

But the webview seems to view it as a hover event and the link or whatever is just highlighted instead of clicked.

Any idea what I'm doing wrong?

JMTron
  • 65
  • 1
  • 5
  • You can check [this post](http://stackoverflow.com/questions/4396059/how-to-simulate-a-touch-event-in-android) – Riki Jan 20 '15 at 02:37
  • this is happening to me as well even with the MotionEvent.ACTION_UP and the rest of the code from the above linked post. Did the code from the linked post work for you? – pale bone Sep 05 '18 at 19:13

0 Answers0