Using Android Parcels to preserve state of custom LinearLayout. Issue with arrays
<p>Finally figured how to test this functionality (enabled "destroy activities") and finding more issues with application.</p>

<p>Consider following class where I save properties inside of parcel:</p>

<pre><code>static class SavedState extends BaseSavedState
    {
        private String mName;
        private int mIndex;
        private boolean[] mSelectedDamages = new boolean[20];

        SavedState(Parcelable superState)
        {
            super(superState);
        }

        private SavedState(Parcel in)
        {
            super(in);

            Log.d(LOG_TAG, "SavedState - READING FROM PARCEL----------------------------------------");

            mName = in.readString();
            mIndex = in.readInt();
            in.readBooleanArray(mSelectedDamages);
        }

        @Override
        public void writeToParcel(Parcel out, int flags)
        {
            super.writeToParcel(out, flags);

            Log.d(LOG_TAG, "SavedState - WRITING TO PARCEL----------------------------------------");

            out.writeString(mName);
            out.writeInt(mIndex);
            out.writeBooleanArray(mSelectedDamages);
        }

        // Required field that makes Parcelables from a Parcel
        public static final Parcelable.Creator&lt;SavedState&gt; CREATOR =
            new Parcelable.Creator&lt;SavedState&gt;()
            {
                public SavedState createFromParcel(Parcel in)
                {
                    return new SavedState(in);
                }

                public SavedState[] newArray(int size)
                {
                    return new SavedState[size];
                }
            };

    }
</code></pre>

<p>I narrowed down issue to this line:
<code>private boolean[] mSelectedDamages = new boolean[20];</code></p>

<p>I had it like this before:
<code>private boolean[] mSelectedDamages;</code></p>

<p>I really don't know how big it's going to be. Where my problem is - seems like if I declare it without initializing then 'in.readBooleanArray(..' fails with NullPointerException. If I pass properly sized empty array than it works. But I don't know size upfront. Does it mean I have to store another int in a parcel? And then declare array before pulling it out?</p>
