Skip to content
Advertisement

Unable to start activity: java.lang.ArrayIndexOutOfBoundsException

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:

JavaScript

Program code for MainActivity.java

JavaScript

Program code for PlayerActivity.java:

JavaScript

If I understand correctly, then the error is in the following lines:

JavaScript

But… I do not know how to fix the error. Could you help?

Advertisement

Answer

it is because your position is -1, you must check

JavaScript

you have not send position when starting activity

JavaScript
Advertisement