Wednesday, June 16, 2010

ExpandableListView with dynamic images

ExpandableListViews are great, but less great without images within them, particularly dynamic images (set at the time of creation for the list). The examples (here's one that was a reasonable starting point) and snippets on the Web left a lot to be desired, but what I was aiming for was this:

Note the color 'indicator' (in this case) changes based on variables for the child row. Very useful. This is a key feature of a health attribute (eg. weight) and a color indicator (eg. red for overweight).

To accomplish such a thing one needs to do a number of things in concert within the project, the instantiation of the ExpandableListView and the project's resources, hence the difficulties of trying to grok this solely from one code snippet or another. As an added bonus my example includes a ClickListener to detect clicks within the list.

The sample Eclipse project can be downloaded here. Enjoy.


  1. can we develop a dynamic expandable list view and the inner list should also contain dynamic creation list

  2. Hi thanks for giving such a nice tutorial.thank you so i have one doubt.please refer below link and give me solution for waiting for your reply.please help me.this is my link:

  3. Thank u for ur tutorial..It's very useful for me