March 2013
Beginner to intermediate
580 pages
16h 11m
English
Currently, when CriminalIntent launches, it displays an empty list – a big black void. You should give users something to interact with when there are no items in the list.
ListView, because it is a subclass of AdapterView, supports a special View called the “empty view” for this very scenario. If you specify a view for the empty view, the ListView will automatically switch between showing it when there are no items, and showing the list when there are some items.
You can specify the empty view in code using the following AdapterView method:
public void setEmptyView(View emptyView)
Or you can create a layout in XML that specifies both the ListView and the empty view. If you give them resource IDs of @android:id/list ...
Read now
Unlock full access