Example usage for android.util SparseBooleanArray SparseBooleanArray

List of usage examples for android.util SparseBooleanArray SparseBooleanArray

Introduction

In this page you can find the example usage for android.util SparseBooleanArray SparseBooleanArray.

Prototype

public SparseBooleanArray() 

Source Link

Document

Creates a new SparseBooleanArray containing no mappings.

Usage

From source file:org.bangbang.support.v4.widget.HListView.java

/**
     * Defines the choice behavior for the List. By default, Lists do not have any choice behavior
     * ({@link #CHOICE_MODE_NONE}). By setting the choiceMode to {@link #CHOICE_MODE_SINGLE}, the
     * List allows up to one item to  be in a chosen state. By setting the choiceMode to
     * {@link #CHOICE_MODE_MULTIPLE}, the list allows any number of items to be chosen.
     *//from  w  w w  .ja v  a 2  s. c  o m
     * @param choiceMode One of {@link #CHOICE_MODE_NONE}, {@link #CHOICE_MODE_SINGLE}, or
     * {@link #CHOICE_MODE_MULTIPLE}
     */
    public void setChoiceMode(int choiceMode) {
        mChoiceMode = choiceMode;
        if (mChoiceMode != CHOICE_MODE_NONE && mCheckStates == null) {
            mCheckStates = new SparseBooleanArray();
        }
    }

From source file:com.aliasapps.seq.scroller.TwoWayView.java

@TargetApi(14)
private SparseBooleanArray cloneCheckStates() {
    if (mCheckStates == null) {
        return null;
    }/*from ww w .  ja  va  2s  . co  m*/

    SparseBooleanArray checkedStates;

    if (Build.VERSION.SDK_INT >= 14) {
        checkedStates = mCheckStates.clone();
    } else {
        checkedStates = new SparseBooleanArray();

        for (int i = 0; i < mCheckStates.size(); i++) {
            checkedStates.put(mCheckStates.keyAt(i), mCheckStates.valueAt(i));
        }
    }

    return checkedStates;
}