index out of bounds exception. array

前端 未结 2 1408
青春惊慌失措
青春惊慌失措 2020-12-19 23:41

I am trying to add the items from my array into the listview but i always get an exception.

below is the code of how i add the items:



        
2条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-20 00:05

    use

    for(int a = 0; a <= presList.size()-1; a++)
    

    OR

    for(int a = 0; a < presList.size(); a++)
    

    instead of

    for(int a = 0; a <= presList.size(); a++)
    

提交回复
热议问题