Posts

Showing posts from July, 2014

ListView

Image
Android  ListView  is a view which groups several items and display them in vertical scrollable list. The list items are automatically inserted to the list using an  Adapter  that pulls content from a source such as an array or database. An adapter actually bridges between UI components and the data source that fill data into UI Component. Adapter can be used to supply the data to like spinner, list view, grid view etc. Consider you have an array of strings you want to display in a ListView, initialize a new  ArrayAdapter. ArrayAdapter adapter = new ArrayAdapter<String>(this, R.layout.listview, StringArray);             Here are arguments for this constructor: First argument is the application context. Most of cases, use this. Second argument layout defines in XML file, having TextView for each string in the array. Final argument is the array of strings which will be shown as a list. Once you have created arrayAdapter, then simply call setAdapter() method on