I just got a strange indexoutofboundsexception that I can\'t seem to reproduce. It seems to be related to my listactivity:
java.lang.IndexOutOfBoundsExceptio
I met the same issue when use ListView with header view or footer view to add/remove. So tried different approaches on Stack Overflow, I found a work around solutions to ignore this errors which to handle dispatchDraw method as below.
public class CustomListView extends ListView{
@Override
protected void dispatchDraw(Canvas canvas) {
try {
super.dispatchDraw(canvas);
} catch (IndexOutOfBoundsException e) {
Log.e("luna", "Ignore list view error ->" + e.toString());
}
}
}
Hope that can help u.
Please refer to this link How to debug Android java.lang.IndexOutOfBoundsException HeaderViewListAdapter.java line
Have Fun@.@