O'Reilly logo

Android Programming: The Big Nerd Ranch Guide by Brian Hardy, Bill Phillips

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

ListFragment, ListView, and ArrayAdapter

Instead of a spinner, you want CrimeListFragment’s ListView to show list items to the user. Each list item should contain data about an instance of Crime.

ListView is a subclass of ViewGroup, and each list item is displayed as a child View object of the ListView. Depending on the complexity of what you need the list to display, these child View objects can be complex View objects or very simple ones.

Your first implementation of providing list items for display will be simple: a list item will only display the title of a Crime, and the View object will be a simple TextView.

Figure 9.6  A ListView with child TextViews

In Figure 9.6, you can see eleven TextViews and a hint of a twelfth. If you were able ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required