4.3.2. ListActivity

When an Activity’s primary task is to display a scrollable list of items, you can extend class ListActivity (package android.app), which uses a ListView that occupies the entire app as its default layout. ListView is a subclass of AdapterView (package android.widget)—a GUI component is bound to a data source via an Adapter object (package android.widget). In this app, we use an ArrayAdapter (package android.widget) to create an object that populates the ListView using data from an ArrayList collection object. This is known as data binding. Several types of AdapterViews can be bound to data using an Adapter. In Chapter 8, you’ll learn how to bind database data to a ListView. For more details on data binding in Android and several ...

Get Android™ How to Program, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.