Everyone, hi! Friends, when you click on the button, a new activity does not start. The following exception occurs: java.lang.ArrayIndexOutOfBoundsException. The log of my error is presented below: Program code for MainActivity.java Program code for PlayerActivity.java: If I understand correctly, then the error is in the following lines: But… I do not know how to fix the error. Could you
Tag: arrayindexoutofboundsexception
Checking adjacent cells in a java ArrayList for minesweeper
I have all my cells stored in an ArrayList and I want to check how many mines they are surrounded by (mines are cells with a not null mine png). I thought of checking the positions -1, +1, -9, +9, -10, +10, -11, +11 relative to each cell and add 1 to a counter inside the cell object. Problem is
2D Array work, out of bounds error, for loop,
One of my school works tells us to make an 2D array, and display what is in the array. I don’t know why it is saying out of bounds, and am kind of stuck. What we where tasked to do is to make, 10 student IDs and 3 tests with scores for each of them, as shown below in the