W/dalvikvm( 5176): threadid=1: thread exiting with uncaught exception (group=0x40015568)E/zhe800_android( 5176): Invalid index 2, size is 0E/zhe800_android( 5176): java.lang.IndexOutOfBoundsException: Invalid index 2, 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:92)E/zhe800_android( 5176): at android.os.Looper.loop(Looper.java:130)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: mainE/AndroidRuntime( 5176): java.lang.IndexOutOfBoundsException: Invalid index 2, 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:92)E/AndroidRuntime( 5176): at android.os.Looper.loop(Looper.java:130)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
Cause:
The error log shows that the specific problem is not located.
Tracking the source code of ListView. It can be seen that the data source bound to the Adapter has an array out of bounds.
At this time, two or more threads may modify the data source at the same time. This problem occurs.
References:
Http://bbs.csdn.net/topics/390775554
Http://blog.csdn.net/tw19811220/article/details/9139595
Http://blog.csdn.net/l_serein/article/details/7706338
Http://www.chengxuyuans.com/Android/63263.html
Http://hi.baidu.com/guoxiaoming/item/7b337449864f3fe11381dacd
Http://bbs.csdn.net/topics/390808917