yuyakaido / CardStackView

📱Tinder like swipeable card view for Android
Apache License 2.0
2.36k stars 448 forks source link

Experiencing crash with the following: Two different ViewHolders have the same stable ID. #311

Closed meets7 closed 4 years ago

meets7 commented 4 years ago

java.lang.IllegalStateException: Two different ViewHolders have the same stable ID. Stable IDs in your adapter MUST BE unique and SHOULD NOT change. ViewHolder 1:ViewHolder{378fd5d position=0 id=-706835574, oldPos=-1, pLpos:-1 not recyclable(1)} View Holder 2:ViewHolder{491f6f7 position=2 id=-706835574, oldPos=-1, pLpos:-1} com.ui.swipertab.cardstack.MyCardStackView{4822423 VFED..... ......ID 21,7-699,1196 #7f0a010c app:id/cardStackView_swiper}, adapter:com.ui.swipertab.cardstack.CardStackAdapter@6bc4ace, layout:com.yuyakaido.android.cardstackview.CardStackLayoutManager@64acdef, context:com.MainActivity@6031bae

Any idea as to why this could be happening? This is not happening on a consistent basis.

Barryrowe commented 4 years ago

This sounds like your data that you are populating the stack with may have duplicates in the property you are using for IDs.

Are you accidentally appending/concatenating data onto your items into the adapter that could result in an ID collision?