At First, my RecyclerView items are ok, but on scrolling, items are shown on the wrong position for example: item 6 shown in position 67. Although onClick listener and getAdapte
None of the methods above worked in every situation for me and I don't want to sacrifice the recyclability. The only working solution that I found is to modify the return for both of these methods inside the adapter to "position" values:
override fun getItemViewType(position: Int): Int {
return position
}
override fun getItemId(position: Int): Long {
return position.toLong()
}
The returned position will be always correct. It needs to be modified if you are using viewType.