I\'m using RecyclerView to display name of the items. My row contains single TextView. Item names are stored in List
I was facing same issue, java.lang.IndexOutOfBoundsException: Inconsistency detected.
Create Custom LinearLayoutManager.
HPLinearLayoutManager.java
public class HPLinearLayoutManager extends LinearLayoutManager {
public HPLinearLayoutManager(Context context) {
super(context);
}
public HPLinearLayoutManager(Context context, int orientation, boolean reverseLayout) {
super(context, orientation, reverseLayout);
}
public HPLinearLayoutManager(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
/**
* Magic here
*/
@Override
public boolean supportsPredictiveItemAnimations() {
return false;
}
}
create instance of HPLinearLayoutManager.
HPLinearLayoutManager hpLinearLayoutManager = new HPLinearLayoutManager(mContext);
recyclerView.setLayoutManager(hpLinearLayoutManager);
Hope this would help you.