Java Code Examples for android.os.Parcel.writeSparseBooleanArray()

The following are Jave code examples for showing how to use writeSparseBooleanArray() of the android.os.Parcel class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: Udacity_Sunshine   File: ItemChoiceManager.java   Source Code and License Vote up 5 votes
public void onSaveInstanceState(Bundle outState) {
    Parcel outParcel = Parcel.obtain();
    outParcel.writeSparseBooleanArray(mCheckStates);
    final int numStates = mCheckedIdStates.size();
    outParcel.writeInt(numStates);
    for (int i=0; i<numStates; i++) {
        outParcel.writeLong(mCheckedIdStates.keyAt(i));
        outParcel.writeInt(mCheckedIdStates.valueAt(i));
    }
    byte[] states = outParcel.marshall();
    outState.putByteArray(SELECTED_ITEMS_KEY, states);
    outParcel.recycle();
}