Adapters

Adapters act as a link between the view and the underlying data source for the list. Lists require the use of an adapter. The adapter provides access to the data items and is responsible for creating a View for each item. A view determines how each list item is displayed. In most cases, this display is uniform for each data item. The display does not have to be uniform, but in that case, developers must implement their own adapters to create the different views.

The super class for all adapters is BaseAdapter, which is an abstract class. The BaseAdapter class has three subclasses, ArrayAdapter, CursorAdapter, and SimpleAdapter. The ArrayAdapter is used to bind an Array or ArrayList to a view. An ArrayAdapter is always parameterized. ...

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.