1

i"m getting crash reports on IndexOutOfBoundsException inside my adapter , it was never happen on my device so i don't know the scenario .

on my getView it crash (itemlist.get(position)):

public View getView(int position, View convertView, ViewGroup parent) {
    View v = convertView;

Object i = itemlist.get(position);

and of course i override getcount , as i mention it was never happen to me but i get reports that is happen to usersaa sometimes

public int getCount() {
    return itemlist.size();
}

any ideas how could it be ? and how to prevent it ?

Jesus Dimrix
  • 4,378
  • 4
  • 28
  • 62

2 Answers2

1

you should use parent in place of itemlist to get data from list.

Object item = parent.getItemAtPosition(position);

String text=item.toString();
raj
  • 2,088
  • 14
  • 23
0

I solve it . And here is my answer. Indexoutofboundsexception with listview

What you have to do is find out whitch view cause this exception. And make sure once the data changed notify the adapter immediately!

Community
  • 1
  • 1
OverLook
  • 21
  • 2