FileDocCategorySizeDatePackage
List3.javaAPI DocGoogle Android v1.5 Example1706Sun Nov 11 13:01:04 GMT 2007com.google.android.samples.view

List3

public class List3 extends android.app.ListActivity
A list view example where the data comes from a cursor, and a SimpleCursorListAdapter is used to map each item to a two-line display.

Fields Summary
Constructors Summary
Methods Summary
protected voidonCreate(android.os.Bundle icicle)

        super.onCreate(icicle);

        // Get a cursor with all phones
        Cursor c = getContentResolver().query(Phones.CONTENT_URI, null, null, null, null);
        startManagingCursor(c);
        
        // Map Cursor columns to views defined in simple_list_item_2.xml
        ListAdapter adapter = new SimpleCursorAdapter(this,
                android.R.layout.simple_list_item_2, c, 
                        new String[] { Phones.NAME, Phones.NUMBER }, 
                        new int[] { android.R.id.text1, android.R.id.text2 });
        setListAdapter(adapter);