【发布时间】:2021-08-01 01:14:01
【问题描述】:
我在我的适配器内收到关于 IndexOutOfBoundsException 的崩溃报告,它从未在我的设备上发生过,所以我不知道这种情况。
在我的 getView 上它崩溃了(itemlist.get(position)):
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
Object i = itemlist.get(position);
当然我会覆盖 getcount ,因为我提到它从未发生在我身上,但我有时会收到发生在用户身上的报告
public int getCount() {
return itemlist.size();
}
任何想法怎么可能?以及如何预防?
【问题讨论】:
-
请提供您的适配器代码!
标签: android android-listview crash indexoutofboundsexception