4.3.1. ListView

Many mobile apps display lists of information. For example, an e-mail app displays a list of new e-mails, an address-book app displays a list of contacts, a news app displays a list of headlines, etc. In each case, the user touches an item in the list to see more information—e.g., the content of the selected e-mail, the details of the selected contact or the text of the selected news story. This app uses a ListView (package android.widget) to display a list of tagged searches that is scrollable if the complete list cannot be displayed on the screen. You can specify how to format each ListView item. For this app, we’ll display each search’s tag as a String in a TextView. In later apps, you’ll completely customize the content that’s ...

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.