How can I test a click at a certain x,y coordinate?
android, testing
Solution
So, this I haven't tried, but giving a look through the documentation, you might be able to do something to this effect:
Capture an `ACTION_DOWN` `MotionEvent` (through the debugger from a touch action) and note its properties (down time, event time, and the meta state). This would only need to be done once to figure out what sort of values you should use to simulate a typical touch event.
In your test program, create a new `MotionEvent` with `MotionEvent.obtain()`
`MotionEvent newTouch = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_DOWN, x, y, metaState);`
Dispatch the event on your view:
`view.dispatchTouchEvent(newTouch);`
Problem
For running tests on an Android app, how can I automate the tap on a x,y coordinate of either the view or the screen? I am hoping that there is some call in ActivityInstrumentationTestCase2 or TouchUtils, but haven't found one yet.