본문 바로가기

Development/Android

[Android] RecyclerView - java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid item position 16(offset:16).state:34 androidx.recyclerview.widget.RecyclerView{3c041c7 VFED.V... ........ 0,0-1080,1450 #7f080058 app:id/common_list_re..

Error log

더보기

java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid item position 16(offset:16).state:34 androidx.recyclerview.widget.RecyclerView{3c041c7 VFED.V... ........ 0,0-1080,1450 #7f080058 app:id/common_list_recycler_view}

java.lang.IndexOutOfBoundsException: Inconsistency detected. Invalid item position 16(offset:16).state:34 androidx.recyclerview.widget.RecyclerView{3c041c7 VFED.V... ........ 0,0-1080,1450 #7f080058 app:id/common_list_recycler_view}

 

How to reproduce

  • Refresh and scroll the list.

 

Solution

  • Create a new data list rather than clearing it on refresh.
mDataset = new ArrayList<>();