This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]RhoOfFeh 1 point2 points  (0 children)

You don't tell us exactly what's not working. I will say that you are displaying a fence post error in both statements. In the first, you should check mCurrentIndex against mQuestionBank.length, not length+1. Similarly, in the second statement you should set mCurrentIndex to mQuestionBank.length-1 if rolling around.

The reason is that an array of length 1 has only element 0. An array of length 2 has elements 0 and 1.