0

この例外が発生しています。IndexOutOfBounds の意味がわかりません。サイズが 0 の配列で 1 番目 (2 番目の要素) にアクセスすると例外が発生する理由がわかりません。私はそれができるはずです。私はiPhone開発者です。

05-16 09:59:11.700: ERROR/AndroidRuntime(10208): FATAL EXCEPTION: main 
05-16 09:59:11.700: ERROR/AndroidRuntime(10208): java.lang.IndexOutOfBoundsException: Invalid index 1, size is 1 
05-16 09:59:11.700: ERROR/AndroidRuntime(10208): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:257) 
05-16 09:59:11.700: ERROR/AndroidRuntime(10208): at java.util.ArrayList.get(ArrayList.java:311) 
05-16 09:59:11.700: ERROR/AndroidRuntime(10208): at android.widget.HeaderViewListAdapter.isEnabled(HeaderViewListAdapter.java:164) 
05-16 09:59:11.700: ERROR/AndroidRuntime(10208): at android.widget.ListView.dispatchDraw(ListView.java:3101) 
05-16 09:59:11.700: ERROR/AndroidRuntime(10208): at android.view.View.draw(View.java:7025) 
05-16 09:59:11.700: ERROR/AndroidRuntime(10208): at android.widget.AbsListView.draw(AbsListView.java:2589) 
05-16 09:59:11.700: ERROR/AndroidRuntime(10208): at android.view.ViewGroup.drawChild(ViewGroup.java:1791) 
05-16 09:59:11.700: ERROR/AndroidRuntime(10208): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1518) 
05-16 09:59:11.700: ERROR/AndroidRuntime(10208): at android.view.ViewGroup.drawChild(ViewGroup.java:1789) 
05-16 09:59:11.700: ERROR/AndroidRuntime(10208): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1518) 
05-16 09:59:11.700: ERROR/AndroidRuntime(10208): at android.view.ViewGroup.drawChild(ViewGroup.java:1789) 
05-16 09:59:11.700: ERROR/AndroidRuntime(10208): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1518) 
05-16 09:59:11.700: ERROR/AndroidRuntime(10208): at android.view.ViewGroup.drawChild(ViewGroup.java:1789) 
05-16 09:59:11.700: ERROR/AndroidRuntime(10208): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1518) 
05-16 09:59:11.700: ERROR/AndroidRuntime(10208): at android.view.ViewGroup.drawChild(ViewGroup.java:1789) 
05-16 09:59:11.700: ERROR/AndroidRuntime(10208): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1518) 
05-16 09:59:11.700: ERROR/AndroidRuntime(10208): at android.view.View.draw(View.java:6904) 
05-16 09:59:11.700: ERROR/AndroidRuntime(10208): at android.widget.FrameLayout.draw(FrameLayout.java:357) 
05-16 09:59:11.700: ERROR/AndroidRuntime(10208): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1864) 
05-16 09:59:11.700: ERROR/AndroidRuntime(10208): at android.view.ViewRoot.draw(ViewRoot.java:1526) 
05-16 09:59:11.700: ERROR/AndroidRuntime(10208): at android.view.ViewRoot.performTraversals(ViewRoot.java:1262) 
05-16 09:59:11.700: ERROR/AndroidRuntime(10208): at android.view.ViewRoot.handleMessage(ViewRoot.java:1866) 
05-16 09:59:11.700: ERROR/AndroidRuntime(10208): at android.os.Handler.dispatchMessage(Handler.java:99) 
05-16 09:59:11.700: ERROR/AndroidRuntime(10208): at android.os.Looper.loop(Looper.java:130) 
05-16 09:59:11.700: ERROR/AndroidRuntime(10208): at android.app.ActivityThread.main(ActivityThread.java:3695) 
05-16 09:59:11.700: ERROR/AndroidRuntime(10208): at java.lang.reflect.Method.invokeNative(Native Method) 
05-16 09:59:11.700: ERROR/AndroidRuntime(10208): at java.lang.reflect.Method.invoke(Method.java:507) 
05-16 09:59:11.700: ERROR/AndroidRuntime(10208): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842) 
05-16 09:59:11.700: ERROR/AndroidRuntime(10208): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) 
05-16 09:59:11.700: ERROR/AndroidRuntime(10208): at dalvik.system.NativeStart.main(Native Method) 
05-17 10:02:27.730: ERROR/AndroidRuntime(11335): FATAL EXCEPTION: main 
05-17 10:02:27.730: ERROR/AndroidRuntime(11335): java.lang.IndexOutOfBoundsException: Invalid index 1, size is 0 
05-17 10:02:27.730: ERROR/AndroidRuntime(11335): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:257) 
05-17 10:02:27.730: ERROR/AndroidRuntime(11335): at java.util.ArrayList.get(ArrayList.java:311) 
05-17 10:02:27.730: ERROR/AndroidRuntime(11335): at android.widget.HeaderViewListAdapter.isEnabled(HeaderViewListAdapter.java:164) 
05-17 10:02:27.730: ERROR/AndroidRuntime(11335): at android.widget.AbsListView.onTouchEvent(AbsListView.java:2143) 
05-17 10:02:27.730: ERROR/AndroidRuntime(11335): at android.widget.ListView.onTouchEvent(ListView.java:3486) 
05-17 10:02:27.730: ERROR/AndroidRuntime(11335): at com.***.**.view.PullToRefreshListView.onTouchEvent(PullToRefreshListView.java:246) 
05-17 10:02:27.730: ERROR/AndroidRuntime(11335): at android.view.View.dispatchTouchEvent(View.java:3900) 
05-17 10:02:27.730: ERROR/AndroidRuntime(11335): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:909) 
05-17 10:02:27.730: ERROR/AndroidRuntime(11335): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:875) 
05-17 10:02:27.730: ERROR/AndroidRuntime(11335): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:875) 
05-17 10:02:27.730: ERROR/AndroidRuntime(11335): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:875) 
05-17 10:02:27.730: ERROR/AndroidRuntime(11335): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:875) 
05-17 10:02:27.730: ERROR/AndroidRuntime(11335): at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:875) 
05-17 10:02:27.730: ERROR/AndroidRuntime(11335): at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:1693) 
05-17 10:02:27.730: ERROR/AndroidRuntime(11335): at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1125) 
05-17 10:02:27.730: ERROR/AndroidRuntime(11335): at android.app.Activity.dispatchTouchEvent(Activity.java:2096) 
05-17 10:02:27.730: ERROR/AndroidRuntime(11335): at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:1677) 
05-17 10:02:27.730: ERROR/AndroidRuntime(11335): at android.view.ViewRoot.deliverPointerEvent(ViewRoot.java:2363) 
05-17 10:02:27.730: ERROR/AndroidRuntime(11335): at android.view.ViewRoot.handleMessage(ViewRoot.java:1890) 
05-17 10:02:27.730: ERROR/AndroidRuntime(11335): at android.os.Handler.dispatchMessage(Handler.java:99) 
05-17 10:02:27.730: ERROR/AndroidRuntime(11335): at android.os.Looper.loop(Looper.java:130) 
05-17 10:02:27.730: ERROR/AndroidRuntime(11335): at android.app.ActivityThread.main(ActivityThread.java:3695) 
05-17 10:02:27.730: ERROR/AndroidRuntime(11335): at java.lang.reflect.Method.invokeNative(Native Method) 
05-17 10:02:27.730: ERROR/AndroidRuntime(11335): at java.lang.reflect.Method.invoke(Method.java:507) 
05-17 10:02:27.730: ERROR/AndroidRuntime(11335): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:842) 
05-17 10:02:27.730: ERROR/AndroidRuntime(11335): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:600) 
05-17 10:02:27.730: ERROR/AndroidRuntime(11335): at dalvik.system.NativeStart.main(Native Method)
4

1 に答える 1

0

あなたのArrayListは空です!!ご覧のとおり、サイズはゼロです。空のarrayListの最初に配置された要素にアクセスしようとしているため、例外がスローされます。このエラーを回避するには、配列リストが空でないことを確認してください

于 2013-05-17T05:40:49.290 に答える