Tutorial :Android Expandable lists having multiple child items in a single row and their onClick event



Question:

I could not figure out how to implement two basic functionalities with the expandable lists: 1. The onClick for the child 2. Using linear layout for the children, so that I can have multiple clickable items in same row under the parent item

Can somebody help me with some sample code for the above?


Solution:1

If someone is still interested - the google guys have written some very good samples for understanding and using expanable lists!

You can either use ExpandableListView (which extends ListView class), or simply create an ExpandableListActivity, which hosts an ExpandableListView.

Just take a look at these three examples. I made screenshots to show what it looks like (only notice that the background color isn't the one from the default theme):

Example 1 - ExpandableList which receives data from a custom ExpandableListAdapter

alt text

Example 2 - ExpandableList which receives data from a CursorAdapter

(no pic)

Example 3 - ExpandableList which receives data from a simple HashMap-based Adapter

alt text


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »