java.lang.ArrayIndexOutOfBoundsException当我使用return super.dispatchTouchEvent(e)时

时间:2016-02-12 18:51:42

标签: android

02-12 21:44:57.115 9180-9180/com.danreegly.test1 E/InputEventReceiver: Exception dispatching input event.
02-12 21:44:57.160 9180-9180/com.danreegly.test1 E/AndroidRuntime: FATAL EXCEPTION: main java.lang.ArrayIndexOutOfBoundsException: length=2; index=2
at android.support.v4.widget.ViewDragHelper.shouldInterceptTouchEvent(ViewDragHelper.java:1014)
at android.support.v4.widget.DrawerLayout.onInterceptTouchEvent(DrawerLayout.java:1140)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2073)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2441)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2174)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2441)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2174)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2441)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2174)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2326)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1612)
at android.app.Activity.dispatchTouchEvent(Activity.java:2494)
at com.danreegly.test1.MainActivity.dispatchTouchEvent(MainActivity.java:1212)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2274)
at android.view.View.dispatchPointerEvent(View.java:8025)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4668)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4556)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4150)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4207)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4176)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4261)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4184)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4318)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4150)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4207)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4176)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4184)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4150)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6302)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6240)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6211)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6382)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:188)
at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(Native Method)
at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:177)
at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:6355)
at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:6401)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:791)
at android.view.Choreographer.doCallbacks(Choreographer.java:591)
at android.view.Choreographer.doFrame(Choreographer.java:559)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:777)
at android.os.Handler.handleCallback(Handler.java:730)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:176)
at android.app.ActivityThread.main(ActivityThread.java:5419)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:525)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1046)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:862)
at dalvik.system.NativeStart.main(Native Method)

1 个答案:

答案 0 :(得分:0)

You must use super.dispatchTouchEvent() first, without return:

 <plugin>
                <groupId>org.jacoco</groupId>
                <artifactId>jacoco-maven-plugin</artifactId>
                <version>${jacoco.version}</version>
                <configuration>
                    <append>true</append>
                </configuration>
                <executions>
                    <execution>
                        <id>default-instrument</id>
                        <goals>
                            <goal>instrument</goal>
                        </goals>
                        <configuration>
                            <includes>
                                <include>**/*test*</include>
                            </includes>
                        </configuration>
                    </execution>
                    <execution>
                        <id>default-restore-instrumented-classes</id>
                        <goals>
                            <goal>restore-instrumented-classes</goal>
                        </goals>
                        <configuration>
                            <includes>
                                <include>**/*test*</include>
                            </includes>
                        </configuration>
                    </execution>
                    <execution>
                        <id>Prepare-Jacoco</id>
                        <goals>
                            <goal>prepare-agent</goal>
                        </goals>
                        <configuration>
                            <excludes>
                                <exclude>**/*test*</exclude>
                            </excludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>