Generally when we deal with menu’s which are to be show in listview,Sometimes we need to show sub-categories so for this purpose we will deal with android Expandable Listview in name itself says that it will be expanded depending upon categories.

Categories are shown as group headers and sub categories are shown as child items.



I have shown a ExpandableListview which contains three categories


  1. Sports
  2. Colors
  3. Animals

Which are further sub categorized for example:


Creating android ExpandableListviewAdapter File


  Assigning expandableListView set onClickListener for group click and child click.


  Adding ExpandableListView to  activity_main.xml.



Adding parent (Group Header).



Adding child_item to listview



Output :


Group and Child On Click Toast


device-2016-04-08-164849 device-2016-04-08-164932

device-2016-04-08-165109 device-2016-04-08-165233

device-2016-04-08-165311 device-2016-04-08-165355

Share article on

Show Buttons
Hide Buttons

June 27, 2017

Attention Required! | Cloudflare

One more step

Please complete the security check to access

Why do I have to complete a CAPTCHA?

Completing the CAPTCHA proves you are a human and gives you temporary access to the web property.

What can I do to prevent this in the future?

If you are on a personal connection, like at home, you can run an anti-virus scan on your device to make sure it is not infected with malware.

If you are at an office or shared network, you can ask the network administrator to run a scan across the network looking for misconfigured or infected devices.

Clear all
Read previous post:
push notification
Android Push Notification Tutorial For Beginners