[List3.java]- Contacts에서 Phones을 가져와 List로 뿌린다.
public class List3 extends ListActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// 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);
}
}
'old > API_Demo' 카테고리의 다른 글
Views_Lists_Separators (0) | 2010.04.27 |
---|---|
Views_Lists_ListAdapter (0) | 2010.04.27 |
Views_Lists_Cursor(People) (0) | 2010.04.27 |
Views_Lists_Array (0) | 2010.04.27 |
Views_Layout_Table Layout_Cell Spanning (0) | 2010.04.26 |