Example usage for android.os Parcel readSparseBooleanArray

List of usage examples for android.os Parcel readSparseBooleanArray

Introduction

In this page you can find the example usage for android.os Parcel readSparseBooleanArray.

Prototype

public final SparseBooleanArray readSparseBooleanArray() 

Source Link

Document

Read and return a new SparseBooleanArray object from the parcel at the current dataPosition().

Usage

From source file:com.harlie.android.sunshine.app.ItemChoiceManager.java

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);
        inParcel.setDataPosition(0);//from  w  w w .  ja  v a2s . c om
        mCheckStates = inParcel.readSparseBooleanArray();
        final int numStates = inParcel.readInt();
        mCheckedIdStates.clear();
        for (int i = 0; i < numStates; i++) {
            final long key = inParcel.readLong();
            final int value = inParcel.readInt();
            mCheckedIdStates.put(key, value);
        }
        inParcel.recycle();
    }
}

From source file:app.com.example.android.sunshine.ItemChoiceManager.java

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);
        inParcel.setDataPosition(0);/*from ww w .  ja  v a2 s  . c  o m*/
        mCheckStates = inParcel.readSparseBooleanArray();
        final int numStates = inParcel.readInt();
        mCheckedIdStates.clear();
        for (int i = 0; i < numStates; i++) {
            final long key = inParcel.readLong();
            final int value = inParcel.readInt();
            mCheckedIdStates.put(key, value);
        }
    }
}