Example usage for android.os Parcel writeSparseBooleanArray

List of usage examples for android.os Parcel writeSparseBooleanArray

Introduction

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

Prototype

public final void writeSparseBooleanArray(SparseBooleanArray val) 

Source Link

Usage

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

public void onSaveInstanceState(Bundle outState) {
    Parcel outParcel = Parcel.obtain();
    outParcel.writeSparseBooleanArray(mCheckStates);
    final int numStates = mCheckedIdStates.size();
    outParcel.writeInt(numStates);/*from   w ww.  j av  a 2s.  com*/
    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();
}