In the last Post you learnt about the ListActivity class. In this Tutorial I want to introduce you to Adapters and how to use them with ListView.
Adapters are used to bind or connect View with Data Source. Now a data source can be an array, a database or a web service.
An ArrayAdapter enables us to work with Arrays. Creating one is pretty simple.
ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_expandable_list_item_1, colors);
You can follow along with me in the Video above to understand about Adapters.
Source code can be found here
One thought on “Android Basics – Learn how to use Adapter with ListView”