Using the ExpandableListView class
ListView class is great for displaying small to medium amounts of data, but there are times when it will flood your user with far too much information. Think about an email application. If your user is a heavy email user, or subscribes to a few mailing lists, they may well have several hundred emails in a folder. Even though they may not need to scroll beyond the first few, seeing the scrollbar shrink to a few pixels in size doesn't have a good psychological effect on your user.
In desktop mail clients, you will often group the email list by time: Today, yesterday, this week, this month, and forever (or something similar). Android includes the
ExpandableListView for this type of grouping. Each item is nested ...