我创建了一个小安卓游戏,但出现了奇怪的错误。
这是日志:
12-31 16:10:22.407: E/AndroidRuntime(12824): FATAL EXCEPTION: Thread-1461
12-31 16:10:22.407: E/AndroidRuntime(12824): java.lang.IndexOutOfBoundsException: Invalid index 1, size is 0
12-31 16:10:22.407: E/AndroidRuntime(12824): at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251)
12-31 16:10:22.407: E/AndroidRuntime(12824): at java.util.ArrayList.get(ArrayList.java:304)
12-31 16:10:22.407: E/AndroidRuntime(12824): at **.***.****.GameScreen.updatePaused(GameScreen.java:91)
12-31 16:10:22.407: E/AndroidRuntime(12824): at **.***.****.GameScreen.update(GameScreen.java:43)
12-31 16:10:22.407: E/AndroidRuntime(12824): at **.***.****.framework.impl.AndroidFastRenderView.run(AndroidFastRenderView.java:39)
12-31 16:10:22.407: E/AndroidRuntime(12824): at java.lang.Thread.run(Thread.java:856)
这是执行的部分代码:
int len = touchEvents.size();
for(int i = 0; i < len; i++) {
TouchEvent event = touchEvents.get(i); ->>> this line
.
.
.
怎么了 ?