Ceci est le code pour les événements de mouvement dans mes tests d'instrumentation.Événements de mouvement dans android
long downTime = SystemClock.uptimeMillis();
long eventTime = SystemClock.uptimeMillis();
MotionEvent event = MotionEvent.obtain(downTime, eventTime,
MotionEvent.ACTION_DOWN, 100,100, 0);
MotionEvent event2 = MotionEvent.obtain(downTime, eventTime,
MotionEvent.ACTION_UP, 100, 100, 0);
instrumentation.sendPointerSync(event);
instrumentation.sendPointerSync(event2);
Et voici le iam d'erreur se:
java.lang.NullPointerException
at com.ni.fastflip.test.FastFlipWebviewTest.test(FastFlipWebviewTest.java:28)
at java.lang.reflect.Method.invokeNative(Native Method)
at android.test.InstrumentationTestCase.runMethod(InstrumentationTestCase.java:205)
at android.test.InstrumentationTestCase.runTest(InstrumentationTestCase.java:195)
at android.test.ActivityInstrumentationTestCase2.runTest(ActivityInstrumentationTestCase2.java:175)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:169)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:154)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:430)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1447)
tout organisme peut me suggérer ce qu'il faut faire s'il vous plaît
exception de pointeur nul est à instrumentation.sendPointerSync (event); L'événement est nul ici. Que dois-je faire maintenant? – siri
Je ne sais pas: / – Nathan