mercredi 28 juin 2017

How to disabling checkboxes inside recyclerview android

I have list/rows of checkboxes inside recylerview. In my case user can only select 3 checkboxes out of many. As soon as user selects the third checkbox, I want to disable rest of the checkboxes in different rows.

I am capturing selecting/deselecting checkboxes inside adapter class.

As far as I know, I can enable/disable checkboxes inside onBindViewHolder class.

But in my case I want to enable/disable checkboxes, after they have been rendered.

One of the approach I can think is, to call notifyDataSetChanged(); from Activity class and then rerender all the recyclerview.

But I hope there is better way than doing this, inside the adapter class itself.

ps: I am new to android/java.




Aucun commentaire:

Enregistrer un commentaire