Android: Fix java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid item…..

This error occur when the list in adapter clear why user scrolling which make position of item holder changing, lost ref between list and item on ui, error happen in next “notifyDataSetChanged” request.


Review your update list method. If you do something like

mainList.add() or mainList.addAll()

===> Error occur

How to fix. Create new list object for buffer processing and assign again to main list after that

List res = new ArrayList();
res.add();  //add item or modify list
mainList = res;
One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.