Hi wang_11o1,
The exception
Code:
java.lang.IndexOutOfBoundsException: Index: 1, Size: 0
tells us that you are trying to insert an element in the list at index 1 right after you've created it (size 0). So the list doesn't have the index 1 yet.
That means the code
Code:
int i=Integer.parseInt(result[0].toString());
was returning 1 and the next line:
Code:
list.add(i,result[1]);
will try to insert the content of result[1] at index 1 (not yet available).
But if you do it like you've done:
Code:
int i=0;
list.add(i,result[1]);
i++;
the content of result[1] at index 0 (available) and you increment i (so next index will be also available).
Hope you understand now what you're doing.
chucky
Don't forget to rate if this helps
--------------------------------------