My problem is java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0. I don\'t know to fix this error and i not found any problem on my array. I\'m new
The problem is this two lines of code:
quesList=db.getAllQuestions();
currentQ=quesList.get(qid);
The first line actually just returns an empty array, and hence the second line throws unable to get item at position 0.
I think it is better to check the length of quesList before accessing it in this case:
if(quesList.size()>0){
currentQ=quesList.get(qid);
}else{
//maybe put some default question or show no question found message
}