ERROR / AndroidRuntime328:由以下原因引起:java.lang.IndexOutOfBoundsException:无效的索引10,大小为10

问题描述

|                                                                                                                       

解决方法

        您已写
int no_of_rows = list_productname.size()
。是否所有arraylist的大小都大于或等于
list_productname
,这意味着如果任何arraylist的大小小于
list_productname
,则将导致ArrayIndexOutOfBoundsExcption。 因为您要循环从多个arraylist获取数据,直到达到list_productname大小,这是错误的。由于此逻辑而受苦的其他数组列表为
list_productid,list_offername,list_offerid
,等等。您假设其他arraylist的数据最少为
no_of_rows
。 谢谢 迪帕克