@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
VideoTask videoTask = new VideoTask(paccakModel, childPosition, video);
videoTask.execute();
ArrayList<VideoModelXml> test = videoTask.getVideoModelXmls();
test.get(0);
video.setVideoPath(test.get(0).getUrlVideo());
video.start();
return true;
}
I have an arraylist and its size is 1, but when i get at index 0, i get = java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 can anybody tell me, what is going on?
The reason for your issue is videoTask.getVideoModelXmls()
returns nothing. It should be empty. If you want to avoid the crash
ArrayList<VideoModelXml> test = videoTask.getVideoModelXmls();
if (test .size() > 0){
test.get(0);
video.setVideoPath(test.get(0).getUrlVideo());
video.start();
}
Which will avoid your crash.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.