fitnesskim / tree-view-list-android

Automatically exported from code.google.com/p/tree-view-list-android
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

ArrayIndexOutOfBoundException in AbsListView$RecycleBin.addScrapView(...) #5

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I write my adapter extending AbstractTreeViewAdapter and my custom layout for 
tree's nodes with a textview and an imageview.
I execute on emulator, but when select an item (or collapse) it throws an 
ArrayIndexOutOfBoundException at 
android.widget.AbsListView$RecycleBin.addScrapView(AbsListView.java:3572).

I try the versions 1.6, 2.1, 2.3.3 of Android but with same result.

I attach my adapter, custom layout and bean.

Thanks.

Original issue reported on code.google.com by fgomi...@gmail.com on 21 Jun 2011 at 2:22

Attachments:

GoogleCodeExporter commented 9 years ago
It's hard to say. Most likely it's some bug in your code (which I would not 
like to debug for you). If you need my help then try a bit harder to debug your 
code, see where the bug is produced including stack traces and stepping down 
the code and whether you have some hypothesis on what could go wrong. Also if 
you think the problem is caused by some of my code - please try to guess where 
the problem might be and point me there. I have unfortunately little of my time 
to spare on it and if you could narrow down the problems that would be most 
useful. 

Original comment by ja...@potiuk.com on 21 Jun 2011 at 3:56

GoogleCodeExporter commented 9 years ago
Hi,

i'm using your code to do my final project and i have the same problem. But 
i've seen that the problem occurs when my tree has more that 4 levels (0 to 4 
or more). In fact, the tree is shown correctly when the application is started, 
but when i collapse a node the app throws the ArrayIndexOutOfBound exception at 
the same location (at 
Android.widget.AbsListView$RecycleBin.addScrapView(AbsListView.java:3572)) .

I've also tried to throw the exception on your demo code just changing any 
number by 4 in your DEMO_NODES int array. And the Exception is also trhown.

Any help would be thankful.

Roger from Barcelona, Spain.

Original comment by BalRo...@gmail.com on 14 Nov 2011 at 2:59

GoogleCodeExporter commented 9 years ago
Hello Roger, 
The problem is most likely - that you have not changed the LEVEL_NUMBER 
constant in the code. When you create an adapter you specify how many levels 
the tree can have - 4 means levels 0..3  :).

You can see it here:
http://code.google.com/p/tree-view-list-android/source/browse/src/pl/polidea/tre
eview/demo/TreeViewListDemo.java

Original comment by ja...@potiuk.com on 15 Nov 2011 at 10:41