Android "Problem Summary" list array out of bounds problem

Source: Internet
Author: User

Encountered a strange problem, the ListView occurred array out of bounds (occasionally), the program crashes.

The error message is as follows:

W/DALVIKVM (5176): threadid=1: Thread exiting with uncaught exception (group=0x40015568) E/zhe800_android (5176): Invalid Index2, size is 0E/zhe800_android (5176): Java.lang.IndexOutOfBoundsException:Invalid Index2, size is 0E/zhe800_android (5176): At Java.util.ArrayList.throwIndexOutOfBoundsException (Arraylist.java:257) E/zhe800_android (5176): at Java.util.ArrayList.Get(Arraylist.java:311) E/zhe800_android (5176): At Android.widget.HeaderViewListAdapter.getView (Headerviewlistadapter.java:225) E/zhe800_android (5176): At Android.widget.AbsListView.obtainView (Abslistview.java:1424) E/zhe800_android (5176): At Android.widget.ListView.makeAndAddView (Listview.java:1755) E/zhe800_android (5176): At Android.widget.ListView.fillUp (Listview.java:704) E/zhe800_android (5176): At Android.widget.ListView.fillGap (Listview.java:650) E/zhe800_android (5176): At Android.widget.AbsListView.trackMotionScroll (Abslistview.java:3422) E/zhe800_android (5176): At Android.widget.abslistview$flingrunnable.run (Abslistview.java:2920) E/zhe800_android (5176): At Android.os.Handler.handleCallback (Handler.java:587) E/zhe800_android (5176): At Android.os.Handler.dispatchMessage (Handler.java: the) E/zhe800_android (5176): At Android.os.Looper.loop (Looper.java: the) E/zhe800_android (5176): At Android.app.ActivityThread.main (Activitythread.java:3703) E/zhe800_android (5176): At Java.lang.reflect.Method.invokeNative (Native Method) E/zhe800_android (5176): At Java.lang.reflect.Method.invoke (Method.java:507) E/zhe800_android (5176): at Com.android.Internal. os. Zygoteinit$methodandargscaller.run (Zygoteinit.java:866) E/zhe800_android (5176): at Com.android.Internal. os. Zygoteinit.main (Zygoteinit.java:624) E/zhe800_android (5176): At Dalvik.system.NativeStart.main (Native Method) E/androidruntime (5176): FATAL exception:main E/androidruntime (5176): Java.lang.IndexOutOfBoundsException:Invalid Index2, size is 0E/androidruntime (5176): At Java.util.ArrayList.throwIndexOutOfBoundsException (Arraylist.java:257) E/androidruntime (5176): at Java.util.ArrayList.Get(Arraylist.java:311) E/androidruntime (5176): At Android.widget.HeaderViewListAdapter.getView (Headerviewlistadapter.java:225) E/androidruntime (5176): At Android.widget.AbsListView.obtainView (Abslistview.java:1424) E/androidruntime (5176): At Android.widget.ListView.makeAndAddView (Listview.java:1755) E/androidruntime (5176): At Android.widget.ListView.fillUp (Listview.java:704) E/androidruntime (5176): At Android.widget.ListView.fillGap (Listview.java:650) E/androidruntime (5176): At Android.widget.AbsListView.trackMotionScroll (Abslistview.java:3422) E/androidruntime (5176): At Android.widget.abslistview$flingrunnable.run (Abslistview.java:2920) E/androidruntime (5176): At Android.os.Handler.handleCallback (Handler.java:587) E/androidruntime (5176): At Android.os.Handler.dispatchMessage (Handler.java: the) E/androidruntime (5176): At Android.os.Looper.loop (Looper.java: the) E/androidruntime (5176): At Android.app.ActivityThread.main (Activitythread.java:3703) E/androidruntime (5176): At Java.lang.reflect.Method.invokeNative (Native Method) E/androidruntime (5176): At Java.lang.reflect.Method.invoke (Method.java:507) E/androidruntime (5176): at Com.android.Internal. os. Zygoteinit$methodandargscaller.run (Zygoteinit.java:866) E/androidruntime (5176): at Com.android.Internal. os. Zygoteinit.main (Zygoteinit.java:624) E/androidruntime (5176): At Dalvik.system.NativeStart.main (Native Method) W/activitymanager (197): Force finishing Activity com.tuan800.tao800/.activities. Categorydealactivity

From the error log, no specific problem is located.

Tracking the source of the ListView, you can see that the data source bound to the adapter has an array out of bounds.

Because at this point, there may be two or more threads modifying the data source at the same time.

Cause this problem to happen.

Android "Problem Summary" list array out of bounds problem

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.