Skip to content Skip to sidebar Skip to footer

My Android App Has Indexoutofboundsexception, How To Solve?

My Android app crash reporting service has reported many instances of: java.lang.IndexOutOfBoundsException: Invalid index 1, size is 1 at java.util.ArrayList.throwIndexOutOfBoundsE

Solution 1:

Your exception itself tells answer.You are trying to access element 1 which will be second element of array and array size is 1. Try to check size of array before accessing

Solution 2:

Access element at 0th index because your array size is 1 means it contain single element at 0th index position

java.lang.IndexOutOfBoundsException is thrown because your array contain only one element. It's at location index 0 not at 1. you are accessing element at index 1 which is not possible.

Try to access 0 index only don't go for more than 0.

Post a Comment for "My Android App Has Indexoutofboundsexception, How To Solve?"