Things you can do with a ListActivity

 1package org.anddev.android.listviews;
 2
 3import android.app.ListActivity;
 4import android.os.Bundle;
 5import android.widget.ArrayAdapter;
 6
 7public class ListViewDemo extends ListActivity {
 8    /** Called when the activity is first created. */
 9    @Override
10    public void onCreate(Bundle icicle) {
11        super.onCreate(icicle);
12        // Create an array of Strings, that will be put to our ListActivity
13        String[] mStrings = new String[]{"Android""Google""Eclipse"};
14
15        // Create an ArrayAdapter, that will actually make the Strings above appear in the ListView
16        this.setListAdapter(new ArrayAdapter<String>(this,
17                         android.R.layout.simple_list_item_1, mStrings));
18    }

19}

posted on 2009-01-09 16:09  Edgar Sun  阅读(210)  评论(0编辑  收藏  举报

导航