开发者

Listview using arraylist

How can we create the listview using arraylist in a simp开发者_JAVA技巧le way


ListView lv=(ListView)findViewById(R.id.lv01);  String[] names = new String[] { "Show Hidden Files", "Suffle Tab Position"};

    // Create an ArrayAdapter, that will actually make the Strings above
    // appear in the ListView
    this.setListAdapter(new ArrayAdapter<String>(this,
            android.R.layout.simple_list_item_checked, names));


I'd use a BaseAdapter, and override the necessary methods to make it use the ArrayList<?>.

In this post the MyELAdapter is used for an expandable list view, but the base logic is there, it populates the listview with Parent instances from an ArrayList<Parent>.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜