How can we create the listview using arraylist in a simple way
Asked
Active
Viewed 809 times
0
-
3please elaborate and search a little over the internet before asking questions.... you can find plenty of work related to your question. Check this link: http://developer.android.com/resources/tutorials/views/hello-listview.html and this: http://www.vogella.de/articles/AndroidListView/article.html – Farhan Apr 13 '11 at 10:41
2 Answers
0
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));

Harinder
- 11,776
- 16
- 70
- 126
0
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>
.