tags:

views:

51

answers:

2

Hello,

I have been playing around with following android app example.

http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/ExpandableList2.html

I am able to trigger an action when a child is clicked however I cannot seem to figure out how to: 1. Customize the label of each child. 2. Change how each child looks. (for example I would like each child to display the phone number and then two graphical buttons on the right. Each button would have a custom action tied to it.)

Any code or links would be greatly appreciated.

A: 

You might want to take a look to CursorTreeAdapter and bindChildView method.

fedj
A: 

One possible solution might be to set a SimpleCursorTreeAdapter.ViewBinder using setViewBinder, much like you would for a SimpleCursorAdapter.

I am not at all sure that this will work, since I have not tried it, but it seems to be similar. I am trying to solve the same problem, so if it does not work, I'll try to post here.

Mikael Ohlson
Right, so what I've learned so far: The SimpleCursorTreeAdapter.ViewBinder was introduced in API-level 5. I am aiming at a level-4 device. :/
Mikael Ohlson
I'm new to Android and what I'm really struggling with is figuring out how to "take over" the creation of the children so that I can assign layout and add elements programatically. I'm able to change the look of each child using only the XML but when it comes to handling events and assigning dynamic attributes I'm pretty much stomped.