Iterating Through a Sparse Array

Total Post:341

C#  .NET 
 1550  View(s)
Rate this:

Is there a way to iterate over java SparseArray (for android) ? I used sparsearray to easily get values by index.

I could not find one.

  1. Post:194

    Re: Iterating Through a Sparse Array

    seems I found the solution. I haven't properly noticed keyAt(index) function.

    So I'll go with something like this
    int key = 0;
            for (int i = 0; i < sparseArray.size(); i++)
                key = sparseArray.keyAt(i);
                // get the object by the key.
                Object obj = sparseArray.get(key);

      Modified On Apr-05-2018 11:42:38 PM