Error java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 in my program android

后端 未结 2 1753
一个人的身影
一个人的身影 2021-01-12 07:22

I start to developpe in android, and I try to modify Snake code for including a call to browser for desplaying web page, when i execute my application it shows the page in t

2条回答
  •  甜味超标
    2021-01-12 07:46

    You have an ArrayList with 0 elements in them. and in the SnakeView class in the updateSnake() method on line 448, you try to access the arraylist at index 0. At index 0 is the first element of you ArrayList, but if it is empty there is no element at index 0. So you get an IndexOutOfBoundsException

提交回复
热议问题