利用CursorAdapter在ListView中显示Cursor中不同同类型的item,加载均正常,滚动时报如下错误:
11-28 15:18:16.703: E/InputEventReceiver(3155): Exception dispatching input event.
11-28 15:18:16.703: E/MessageQueue-JNI(3155): Exception in MessageQueue callback: handleReceiveCallback
11-28 15:18:16.707: E/MessageQueue-JNI(3155): java.lang.ArrayIndexOutOfBoundsException: length=2; index=2
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.widget.AbsListView$RecycleBin.addScrapView(AbsListView.java:6739)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.widget.AbsListView.trackMotionScroll(AbsListView.java:5114)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.widget.AbsListView.onGenericMotionEvent(AbsListView.java:3811)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.View.dispatchGenericMotionEventInternal(View.java:7801)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.View.dispatchGenericMotionEvent(View.java:7782)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.ViewGroup.dispatchTransformedGenericPointerEvent(ViewGroup.java:1824)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.ViewGroup.dispatchGenericPointerEvent(ViewGroup.java:1777)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.View.dispatchGenericMotionEvent(View.java:7775)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.ViewGroup.dispatchTransformedGenericPointerEvent(ViewGroup.java:1824)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.ViewGroup.dispatchGenericPointerEvent(ViewGroup.java:1777)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.View.dispatchGenericMotionEvent(View.java:7775)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.ViewGroup.dispatchTransformedGenericPointerEvent(ViewGroup.java:1824)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.ViewGroup.dispatchGenericPointerEvent(ViewGroup.java:1777)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.View.dispatchGenericMotionEvent(View.java:7775)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.ViewGroup.dispatchTransformedGenericPointerEvent(ViewGroup.java:1824)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.ViewGroup.dispatchGenericPointerEvent(ViewGroup.java:1777)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.View.dispatchGenericMotionEvent(View.java:7775)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.ViewGroup.dispatchTransformedGenericPointerEvent(ViewGroup.java:1824)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.ViewGroup.dispatchGenericPointerEvent(ViewGroup.java:1777)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.View.dispatchGenericMotionEvent(View.java:7775)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.ViewGroup.dispatchTransformedGenericPointerEvent(ViewGroup.java:1824)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.ViewGroup.dispatchGenericPointerEvent(ViewGroup.java:1777)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.View.dispatchGenericMotionEvent(View.java:7775)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchGenericMotionEvent(PhoneWindow.java:2076)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at com.android.internal.policy.impl.PhoneWindow.superDispatchGenericMotionEvent(PhoneWindow.java:1525)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.app.Activity.dispatchGenericMotionEvent(Activity.java:2494)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchGenericMotionEvent(PhoneWindow.java:2030)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.View.dispatchPointerEvent(View.java:7888)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:3947)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:3826)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3392)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3442)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3411)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:3518)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3419)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:3575)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3392)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:3442)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:3411)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:3419)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:3392)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:5532)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:5512)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:5483)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:5612)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.os.MessageQueue.nativePollOnce(Native Method)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.os.MessageQueue.next(MessageQueue.java:138)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.os.Looper.loop(Looper.java:123)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at android.app.ActivityThread.main(ActivityThread.java:5001)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at java.lang.reflect.Method.invokeNative(Native Method)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at java.lang.reflect.Method.invoke(Method.java:515)
11-28 15:18:16.707: E/MessageQueue-JNI(3155): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java
解决方法:分析错误提示感觉核心要素是由于MessageQuene队列超越边界了,故考虑将Adapter中item类型的数目增大实际只有2种但是设置为3种,发现此bug解决,根本原因不详,还请大神赐教。难道item的类型数目决定了messageQuene的大小?