Example usage for android.util SparseBooleanArray clone

List of usage examples for android.util SparseBooleanArray clone

Introduction

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

Prototype

@Override
    public SparseBooleanArray clone() 

Source Link

Usage

From source file:Main.java

public static SparseBooleanArray cloneSBArray(SparseBooleanArray arr) {
    try {/* w w  w.  jav a2 s .  c o  m*/
        return arr.clone();
    } catch (Exception e) {
        // Happens when using HC - should clone manually
        int size = arr.size();
        SparseBooleanArray clone = new SparseBooleanArray();
        for (int i = 0; i < size; i++) {
            if (arr.get(arr.keyAt(i))) {
                clone.put(arr.keyAt(i), true);
            }
        }
        return clone;
    }
}