user5311329
user5311329

Reputation:

Recyclerview selected position automatically change on scroll in android

i need single selection recyclerview. but when i click on particular item it is selected but while i scroll the recyclerview other positions item also selected automatically. I cant found all items view. I just found visible items view. I need all item views which is not visible on mobile screen but that item is present in adapter. thanx in advance

Upvotes: 1

Views: 1328

Answers (2)

user2100931
user2100931

Reputation:

Don't use notifiyDataSetChanged().
Use dataList.notifiItemDatachanged(int pos)`
. It will replace with particular position and will not refresh whole list.

Upvotes: 1

Ronak Joshi
Ronak Joshi

Reputation: 1583

I think you messing up with recyclview's property. First you have to make an array then that array have to be passed in your recyclview. Then on click of item of recycle list, on the basis of position of click you have to pass some attribute on particular postion and notify your adapter by giving adapter.notifiyDataSetChanged(); For reference check this link, RecyclerView with CheckBox Example

Upvotes: 0

Related Questions