In programming, indexes often start at 0, so if you have 9 elements, the highest index will be 8.
The actual error is thrown from some code in the library that you are using
org.anddev.andengine.entity.Entity.onManagedDrawChildren(Entity.java:1008)
You are probably changing the list in a separate thread, while the library also interacts with the list.
From gcode project ;
public void onManagedDrawChildren(final Camera pCamera) { final ArrayList<IEntity> children = this.mChildren; final int childCount = children.size(); for(int i = 0; i < childCount; i++) { children.get(i).onDraw(pCamera); } }
Since this runs in a separate thread, you are likely to remove the object from the children of the ArrayList while the loop iterates. To fix this, you should call your changes to the ArrayList children, as jmr499485 explains in your answer.
java.lang.IndexOutOfBoundsException: invalid index 13, size 13
The only element in the code that I see will be the reason that this is a questionText.detachSelf(); statement questionText.detachSelf(); which you used in many places. Instead you should use;
runOnUpdateThread(new Runnable() { @Override public void run() { questionText.detachSelf(); } });
source share