Time for action - creating the CursorAdapter

The CursorAdapter is much more complex to set up than the ArrayAdapter. For one thing, we offer more options with the CursorAdapter than we did with the ArrayAdapter. Our CursorAdapter can be made to display either one or two line list items, based on whether there are one or two columns specified. While the ArrayAdapter includes some default filtering logic, we need to provide a little more support for the CursorAdapter.

  1. To start with, we allow for two different column naming conventions to be used, along with some defaults. Declare a utility method to find the expected column names from the Intent:
    private String getColumnName(
    final Intent intent, String primary, String secondary, String def) {

Get Android User Interface Development now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.