Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

lance fallon
lance fallon
1,658 Points

Make Custom views parcelable

Hopefully this question winds up in the right place... If not, in the Android Fragments Series, there is a video we need to save state of a list of CheckBox views' "checked" value. In the video, we are generating an array of booleans to be stored in the bundle, instead of just saving the CheckBox array, since View does not implement parcelable. As a result, we're jumping through a few hoops to restore the CheckBoxes to their correct state.

Is there a pattern / solution to make custom views parcelable, so that we can save state without a workaround such as in the video? I suppose subclassing could be an option, but that would seem like a pain with all the properties needed to serialize.