How to iterate through SparseArray?

后端 未结 10 1723
野的像风
野的像风 2020-11-30 18:16

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.

10条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-30 18:39

    For removing all the elements from SparseArray using the above looping leads to Exception.

    To avoid this Follow the below code to remove all the elements from SparseArray using normal loops

    private void getValues(){      
        for(int i=0; i

提交回复
热议问题