ListActivity in ApiDemos/Views/Lists

1 and 5 are cheeses. Each item is a single line. 10 and 11 are also single-line items, with radio buttons and check boxes. See also ApiDemos/Views/Expandable Lists.

Each item in 4 and 6 is a LinearLayout containing two TextViews. Each item in 8 is an ImageView.

2 reads from Contacts, 12 from an EditText.

9 and 13 have OnScrollListeners. Is scrolling in progress? Where have we scrolled to? How much of the total list is currently visible?

  1. ApiDemos/Views/Lists/1. Array
    1. List1.java: cheeses of the world. setTextFilterEnabled lets you type.

  2. ApiDemos/Views/Lists/2. Cursor (People)
    1. List2.java: read the contacts database. Put a Cursor into a SimpleCursorAdapter.

  3. ApiDemos/Views/Lists/3. Cursor (Phone)
    1. List3.java: read the contacts database. More complicated than ¶ 2.

  4. ApiDemos/Views/Lists/4. ListAdapter
    1. List4.java. Each item in the list is a LinearLayout containing two TextViews (one-line title and big body). Quotes from Shakespeare. notifyDataSetChanged tells the view to redraw itself.

  5. ApiDemos/Views/Lists/5. Separators
    1. List5.java. The cheeses in ¶ 1 with rows of dashes. ----------

  6. ApiDemos/Views/Lists/6. ListAdapter Collapsed
    1. List6.java. The LinearLayouts in ¶ 4. Display the one-line title and pop up the body. setVisibility makes a view invisible. notifyDataSetChanged. notifyDataSetChanged tells the adapter to tell the ListView to redraw itself.

  7. ApiDemos/Views/Lists/8. Photos
    1. List8.java. Each line in the TableView is an ImageView.

  8. ApiDemos/Views/Lists/9. Array (Overlay)
    1. List9.java. The cheeses in ¶ 1, with their initials displayed in a Toast. The ListActivity implements the interface ListView.OnScrollListener and has the method onScroll.

  9. ApiDemos/Views/Lists/10. Single choice list.
    1. List10.java. A radio button on each line. The file /Users/myname/Downloads/android-sdk-mac_x86/platforms/android-11/data/res/layout/simple_list_item_single_choice.xml on your hard disk contains a CheckedTextView with the property android:checkMark="?android:attr/listChoiceIndicatorSingle".

  10. ApiDemos/Views/Lists/11. Multiple choice list.
    1. List11.java. A check box on each line. The file /Users/myname/Downloads/android-sdk-mac_x86/platforms/android-11/data/res/layout/simple_list_item_multiple_choice.xml on your hard disk contains a CheckedTextView with the property android:checkMark="?android:attr/listChoiceIndicatorMultiple".

  11. ApiDemos/Views/Lists/12. Transcript
    1. List12.java. Call the add method of the ArrayAdapter to add another line.

  12. ApiDemos/Views/Lists/13. Slow adapter.
    1. List13.java. The ListActivity implements the interface ListView.OnScrollListener. Status line at the bottom tells you when the list is busy scrolling.

  13. ApiDemos/Views/Lists/14. Fast adapter.
    1. List14.java. Adapter recycles the views.