Android: Handling Checkbox state in Recycler Views.

Ozioma Ogbe
AndroidPub
Published in
1 min readOct 18, 2017

--

In Android development, developers usually have to handle some sort of selection from a list of items. When these items could potentially become many, then a Recycler view is usually a good choice for holding these items because it recycles it’s content and thus improves performance. But since Recycler view recycles it’s items, views that have toggling behaviour(check boxes, switches erc) usually behave unpredictably with Recycler Views this especially happens when developers do not handle the logic of displaying the current state of the view (checked/unchecked)

The common way a developer can go about setting the state of the view is set it to checked when the view is clicked then uncheck it when the view is clicked again by checking the previous state of the view.

I migrated this story to my blog, please continue reading here

https://blog.oziomaogbe.com/2017/10/18/android-handling-checkbox-state-in-recycler-views.html

--

--

Ozioma Ogbe
AndroidPub

Interested in Software Engineering and Chess. I now write at https://blog.oziomaogbe.com