ExpandableListView is kind of advanced version of Listview. You can expand the list items. It is very useful when you have categories and sub categories of data. Here a tutorial using for ExpandableListView with event listener of parent and child list items.
- Create main_activity.xml.
- Create list_group.xml
- Create list_item.xml.
- Create the ExpandableListAdapter.java.
- Create MainActiviy.java.
The file main_activity.xml contain the ExpandableListView tag. list_item.xml and list_gruop.xml has the TextViews for list and sublist.
You can get the complete project at Github Repository. Or you can get the code below in this post.
Here is you main_activiy.xml
list_group.xml
list_item.xml
ExpandableListAdapter.java
MainActivity.java