Problem involving the index of an ArrayList in Java

I am making a mock directory. This method is called when a button is clicked, and should display a new student file on the screen. It works perfectly unless I go out of bounds for the arraylist. I know that is an out of bounds exception, but I thought I handled it with the if() statement. For clarification, studentRecord is an arraylist that contains String arrays. These String arrays hold the name, divison, ID, etc of a student.

Here is my code:

public void previousStudent(View view){


if(counter < 0){counter = studentRecords.size();}

tvID.setText("Student ID: "...

Read More »

By: StackOverFlow - Thursday, 8 November

Related Posts