0
votes

I'm trying to add a full custom Listview (with custom adapter) into an other custom ListView items.

I've tried two things :

1 : Using two custom ArrayAdapters and call the second one into the getView method of the first one. So each item gets populated with its own list. Result : It kinda works but I'm having problems to bind the right children list to the item inside getView and I thought I was probably doing an awful thing.

2: Using a expandableListView with its custom BaseExpandableListAdapter. It works better for binding parents/children items but I'm not able to put the children items into a specific listview inside the parent item. It just puts the children items after the entire parent item.

Is one of these methods supposed to work or can I use something else?

2

2 Answers

1
votes

You can actually use expandable list for that purpose, It has already 2 level though you can make it as much as you can.

You can customize parent and children, it'll better than adding element one by one manually.

I believe that's purpose of creation of expandable list.

0
votes

Ok. I think I just had desing problem. When you end up trying to nest ListViews, maybe the problem is just that what you are trying to do is not good.

It is true that I have an undefined number of elements that I want to display one below the other, which contains each a listview. But that doesn't mean that these elements should be wrapped into a listview. A simple for-loop to add each element to the Layout was a better option. Then, no problem with the lisview inside each element.