Attach items to a listview

A listview shows data provided by an adapter. To create a simple list use the following:

//Find the listview with id 'list' in the resources 
ListView listView = (ListView) findViewById(R.id.list);

//Make a connection through an adapter 
listView.setAdapter(new ArrayAdapter<String>(MainActivity.this, android.R.layout.simple_list_item_1, new String[] {"AAA", "BBB", "CCC"}));


Lastest update in October 2012, inital post in October 2012

Write a comment

I appreciate comments, suggestions, compliments etc. Unfortunately I have no time to reply to them. Useful input will be used for sure!