Iterating Through a Sparse Array

Total Post:341

Points:2389
C#  .NET 
 1425  View(s)
Ratings:
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

    Points:1396
    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

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!