[List2.java] - Contacts에서 꺼내와 List로 뿌린다.
public class List2 extends ListActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Get a cursor with all people
Cursor c = getContentResolver().query(People.CONTENT_URI, null, null, null, null);
startManagingCursor(c);
ListAdapter adapter = new SimpleCursorAdapter(this,
// Use a template that displays a text view
android.R.layout.simple_list_item_1,
// Give the cursor to the list adatper
c,
// Map the NAME column in the people database to...
new String[] {People.NAME} ,
// The "text1" view defined in the XML template
new int[] {android.R.id.text1});
setListAdapter(adapter);
}
}
'old > API_Demo' 카테고리의 다른 글
Views_Lists_ListAdapter (0) | 2010.04.27 |
---|---|
Views_Lists_Cursor(Phones) (0) | 2010.04.27 |
Views_Lists_Array (0) | 2010.04.27 |
Views_Layout_Table Layout_Cell Spanning (0) | 2010.04.26 |
Views_Layout_Table Layout_Gravity (0) | 2010.04.26 |