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

The following are Jave code examples for showing how to use readSparseBooleanArray() 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.
+ Save this method
Example 1
Project: Udacity_Sunshine   File:   View Source Code Vote up 7 votes
public void onRestoreInstanceState(Bundle savedInstanceState) {
    byte[] states = savedInstanceState.getByteArray(SELECTED_ITEMS_KEY);
    if ( null != states ) {
        Parcel inParcel = Parcel.obtain();
        inParcel.unmarshall(states, 0, states.length);
        mCheckStates = inParcel.readSparseBooleanArray();
        final int numStates = inParcel.readInt();
        for (int i=0; i<numStates; i++) {
            final long key = inParcel.readLong();
            final int value = inParcel.readInt();
            mCheckedIdStates.put(key, value);