옵션 |
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | public class TestInstrumentation extends InstrumentationTestCase { private Instrumentation i; private UiAutomation automation; final long eventTime = SystemClock.uptimeMillis(); private int inputDevice = InputDevice.SOURCE_TOUCHSCREEN; @Override public void setUp() throws Exception { super.setUp(); i = getInstrumentation(); automation = i.getUiAutomation();//오류 발생!! } public void uiautomationTouch(int x, int y){ MotionEvent motionDown = MotionEvent.obtain(eventTime, eventTime, KeyEvent.ACTION_DOWN, x, y, 0); motionDown.setSource(inputDevice); automation.injectInputEvent(motionDown, true); MotionEvent motionUp = MotionEvent.obtain(eventTime, eventTime, KeyEvent.ACTION_UP, x, y, 0); motionUp.setSource(inputDevice); automation.injectInputEvent(motionUp, true); motionUp.recycle(); motionDown.recycle(); } } | cs |