我在我的应用中使用轮播。
对于拥有Android 4.2.2且仅在横向模式下的用户,他们会报告此问题:
12-19 15:01:56.685: E/InputEventReceiver(7009): Exception dispatching input event.
12-19 15:01:56.685: E/MessageQueue-JNI(7009): Exception in MessageQueue callback: handleReceiveCallback
12-19 15:01:56.695: E/MessageQueue-JNI(7009): java.lang.ArrayIndexOutOfBoundsException: length=12; index=-1
12-19 15:01:56.695: E/MessageQueue-JNI(7009): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2076)
12-19 15:01:56.695: E/MessageQueue-JNI(7009): at com.digitalaria.gama.carousel.CarouselBehavior.dispatchTouchEvent(CarouselBehavior.java:1768)
12-19 15:01:56.695: E/MessageQueue-JNI(7009): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2401)
12-19 15:01:56.695: E/MessageQueue-JNI(7009): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2091)
12-19 15:01:56.695: E/MessageQueue-JNI(7009): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2401)
12-19 15:01:56.695: E/MessageQueue-JNI(7009): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2091)
12-19 15:01:56.695: E/MessageQueue-JNI(7009): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2401)
12-19 15:01:56.695: E/MessageQueue-JNI(7009): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2091)
12-19 15:01:56.695: E/MessageQueue-JNI(7009): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2401)
12-19 15:01:56.695: E/MessageQueue-JNI(7009): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2091)
12-19 15:01:56.695: E/MessageQueue-JNI(7009): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2401)
12-19 15:01:56.695: E/MessageQueue-JNI(7009): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2091)
12-19 15:01:56.695: E/MessageQueue-JNI(7009): at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2401)
12-19 15:01:56.695: E/MessageQueue-JNI(7009): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2091)
12-19 15:01:56.695: E/MessageQueue-JNI(7009): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2284)
12-19 15:01:56.695: E/MessageQueue-JNI(7009): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1578)
12-19 15:01:56.695: E/MessageQueue-JNI(7009): at android.app.Activity.dispatchTouchEvent(Activity.java:2468)
12-19 15:01:56.695: E/MessageQueue-JNI(7009): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2232)
12-19 15:01:56.695: E/MessageQueue-JNI(7009): at android.view.View.dispatchPointerEvent(View.java:7876)
12-19 15:01:56.695: E/MessageQueue-JNI(7009): at android.view.ViewRootImpl.deliverPointerEvent(ViewRootImpl.java:3894)
12-19 15:01:56.695: E/MessageQueue-JNI(7009): at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:3778)
12-19 15:01:56.695: E/MessageQueue-JNI(7009): at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5030)
12-19 15:01:56.695: E/MessageQueue-JNI(7009): at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5009)
12-19 15:01:56.695: E/MessageQueue-JNI(7009): at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:5107)
12-19 15:01:56.695: E/MessageQueue-JNI(7009): at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
12-19 15:01:56.695: E/MessageQueue-JNI(7009): at android.os.MessageQueue.nativePollOnce(Native Method)
12-19 15:01:56.695: E/MessageQueue-JNI(7009): at android.os.MessageQueue.next(MessageQueue.java:125)
12-19 15:01:56.695: E/MessageQueue-JNI(7009): at android.os.Looper.loop(Looper.java:124)
12-19 15:01:56.695: E/MessageQueue-JNI(7009): at android.app.ActivityThread.main(ActivityThread.java:5283)
12-19 15:01:56.695: E/MessageQueue-JNI(7009): at java.lang.reflect.Method.invokeNative(Native Method)
12-19 15:01:56.695: E/MessageQueue-JNI(7009): at java.lang.reflect.Method.invoke(Method.java:511)
12-19 15:01:56.695: E/MessageQueue-JNI(7009): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
12-19 15:01:56.695: E/MessageQueue-JNI(7009): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
12-19 15:01:56.695: E/MessageQueue-JNI(7009): at dalvik.system.NativeStart.main(Native Method)
我无法在这里找到问题所在。
答案 0 :(得分:0)
看起来您正在将Views
存储在数组中。
旋转设备时,将重置此阵列并删除所有视图。当数组适配器尝试获取其位置时,因为该数组为空,它将返回-1
。
尝试处理旋转事件并确保重新填充数组。
如果没有看到一些代码,我无法回答,但它肯定看起来像数组/视图列表被清空或设置为null。