What's causing this IndexOutOfBoundsexception?

view story

http://stackoverflow.com – I have two ArrayLists: ArrayList<String> libraries = new ArrayList<String>(2); ArrayList<String> styles = new ArrayList<String>(2); I have 3 CheckBox components. The three CheckBoxes are supposed to add or remove strings to the ArrayList's however when jqMobileChk is checked an IndexOutOfBoundsException occurs. The three CheckBoxes: jqChk.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if(jqChk.isChecked()){ libraries.add(0,"<script src=\"http://code.jquery.com/jquery-1.8.2.min.js\"></script&gt (HowTos)