Example usage for android.util SparseArray delete

List of usage examples for android.util SparseArray delete

Introduction

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

Prototype

public void delete(int key) 

Source Link

Document

Removes the mapping from the specified key, if there was any.

Usage

From source file:Main.java

public static <T> void deleteInArray(SparseArray<SparseArray<T>> array, int firstKey, int secondKey) {
    if (array == null)
        return;/*  w  ww . j  a va2s  .c o  m*/

    SparseArray<T> ts = array.get(firstKey);
    if (ts == null)
        return;

    synchronized (array) {
        ts.delete(secondKey);

        if (ts.size() == 0) {
            array.delete(firstKey);
        }
    }
}