Lists and Adapters

Two components are required for any list implementation in Android: a ListView widget and an adapter. The ListView widget is an object that can display a vertical list of items that can be scrolled through. An Adapter is dynamically associated with the ListView. The adapter provides access to the underlying data source for the list. In the case of a simple list, after an adapter is associated with the widget, insertion of data as a list item is handled automatically. In the case of a complex list, the developer must create a subclass of an Adapter object and code the display and behavior of the list in the new subclass.

Get Learning Mobile App Development: A Hands-on Guide to Building Apps with iOS and Android 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.