I posted this in the Android sub forum but it doesn't seem to get near as much activity so I thought since it was still Java maybe it would be alright to ask here as well...
Can anyone give me a clue as to why the following code doesn't work? Getting the next element works but getting the previous doesn't. I'm not sure I understand why the next works because the % returns the remainder of the index divided by the array length correct? With the previous code I even tried using mQuestionBank.length but it still crashes when I click the button. I haven't figured where I can look at the exact errors I'm getting in Android Studio yet either which doesn't help.
We shall require more details of what happens before we can help. And Android is not plain simple Java®.
Yes, the % operator returns the remainder when you divide; you can use it to rotate an array, but it won't work at all well if the left operand is negative.
Ok, well then just go ahead and delete this thread as well then. I'm sure I can find an android forum that is a little more active. I don't want to bother anyone with something on a Java thread that isn't Java.