Android ListView caused by:java.lang.arrayindexoutofboundsexception:length=3; Index=3

Source: Internet
Author: User

Android ListView adapter in various types ViewType error:

caused by:java.lang.arrayindexoutofboundsexception:length=3; Index=32 at Android.widget.abslistview$recyclebin.addscrapview (abslistview.java:6822) 3 at Android.widget.AbsListView.trackMotionScroll (abslistview.java:5179) 4 at Android.widget.AbsListView.scrollIfNeeded (abslistview.java:3558) 5 at Android.widget.AbsListView.onTouchMove ( abslistview.java:3969) 6 at Android.widget.AbsListView.onTouchEvent (abslistview.java:3783) 7 at Android.widget.ListView.onTouchEvent (listview.java:4219) 8 at Android.view.View.dispatchTouchEvent (view.java:8556 ) 9 at Android.view.ViewGroup.dispatchTransformedTouchEvent (viewgroup.java:2403) Android.view.ViewGroup.dispatchTouchEvent (viewgroup.java:2096) at Android.view.ViewGroup.dispatchTransformedTouchEvent (viewgroup.java:2409) Android.view.ViewGroup.dispatchTouchEvent (viewgroup.java:2110) at Android.view.ViewGroup.dispatchTransformedTouchEvent (viewgroup.java:2409) at Android.view.ViewGroup.dispatchTouchEvent (Viewgroup.java:2110) at Android.view.ViewGroup.dispatchTransformedTouchEvent (viewgroup.java:2409) Android.view.ViewGroup.dispatchTouchEvent (viewgroup.java:2110) at Android.view.ViewGroup.dispatchTransformedTouchEvent (viewgroup.java:2409) at Android.view.ViewGroup.dispatchTouchEvent (viewgroup.java:2110) at Android.view.ViewGroup.dispatchTransformedTouchEvent (viewgroup.java:2409) at Android.view.ViewGroup.dispatchTouchEvent (viewgroup.java:2110) at Android.view.ViewGroup.dispatchTransformedTouchEvent (viewgroup.java:2409) at Android.view.ViewGroup.dispatchTouchEvent (viewgroup.java:2110) at Android.view.ViewGroup.dispatchTransformedTouchEvent (viewgroup.java:2409) at Android.view.ViewGroup.dispatchTouchEvent (viewgroup.java:2110) at Com.android.internal.policy.impl.PhoneWindow $DecorView. Superdispatchtouchevent (phonewindow.java:2455)    Com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent (phonewindow.java:1756) 27At Android.app.Activity.dispatchTouchEvent (activity.java:2780)-at com.android.internal.policy.impl.phonewindow$ Decorview.dispatchtouchevent (phonewindow.java:2412) at Android.view.View.dispatchPointerEvent (view.java:8751) At Android.view.viewrootimpl$viewpostimeinputstage.processpointerevent (viewrootimpl.java:4200) Android.view.viewrootimpl$viewpostimeinputstage.onprocess (viewrootimpl.java:4066) at Android.view.ViewRootImpl $InputStage. Deliver (viewrootimpl.java:3606) at Android.view.viewrootimpl$inputstage.ondelivertonext ( viewrootimpl.java:3659) at Android.view.viewrootimpl$inputstage.forward (viewrootimpl.java:3625) Android.view.viewrootimpl$asyncinputstage.forward (viewrootimpl.java:3742) at android.view.viewrootimpl$ Inputstage.apply (viewrootimpl.java:3633) Notoginseng at Android.view.viewrootimpl$asyncinputstage.apply (ViewRootImpl.java : 3799) at Android.view.viewrootimpl$inputstage.deliver (viewrootimpl.java:3606) in Android.view.ViewROotimpl$inputstage.ondelivertonext (viewrootimpl.java:3659) at Android.view.viewrootimpl$inputstage.forward ( viewrootimpl.java:3625) at android.view.viewrootimpl$inputstage.apply (viewrootimpl.java:3633) Android.view.viewrootimpl$inputstage.deliver (viewrootimpl.java:3606) at Android.view.ViewRootImpl.deliverInputEvent (viewrootimpl.java:5901) at Android.view.ViewRootImpl.doProcessInputEvents (viewrootimpl.java:5875) at Android.view.ViewRootImpl.enqueueInputEvent (viewrootimpl.java:5846) at android.view.viewrootimpl$ Windowinputeventreceiver.oninputevent (viewrootimpl.java:6012) at Android.view.InputEventReceiver.dispatchInputEvent (inputeventreceiver.java:185) at Android.view.InputEventReceiver.nativeConsumeBatchedInputEvents (Native Method) at Android.view.InputEventReceiver.consumeBatchedInputEvents (inputeventreceiver.java:176) at Android.view.ViewRootImpl.doConsumeBatchedInput (viewrootimpl.java:5962) Wuyi at android.view.viewrootimpl$cOnsumebatchedinputrunnable.run (viewrootimpl.java:6035) 

Solution: http://stackoverflow.com/questions/2596547/ Arrayindexoutofboundsexception-with-custom-android-adapter-for-multiple-views-in

The item view type is returning from

getItemViewType()Is >= getViewTypeCount() .

That is, your ViewType type must start at 0, {0,1,2,3 ...} Like that.

Typecount is greater than the type of the last type.

This solves, the ListView various ViewType slide to the end, the phenomenon of the slip collapse.

Android ListView caused by:java.lang.arrayindexoutofboundsexception:length=3; Index=3

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.