
As we discuss earlier ArrayAdapter is used when we have a list of single item’s backed by an Array. Whenever we have to create a custom list we need to implement custom adapter. This whole thing will make sense when you do one example in Android Studio as discussed at the end of this article. You also specify an XML file(custom list items file) that defines the views used to display the row, and a mapping from keys in the Map to specific views. Each entry in a ArrayList is corresponding to one row of a list. In android you can specify the data backing to a list as an ArrayList of Maps(hashmap or other). In Android, SimpleAdapter is an easy adapter to map static data to views defined in an XML file (layout). SimpleAdpater is used for customization of list or grid items. If you were to attempt to view this app in an emulator, you would not see anything because it has no data connected to it yet.In android, An adapter is a bridge between UI component and data source that helps us to fill data in UI component. NOTE: While you can “see” the ListView display a list of Items and Sub items. In the content_main.xml file in Design mode from the Palette panel, drag-and-drop a ListView component to the top/left corner of the screen.This is an excellent way to store a limited but fixed amount of data that does not need to be changed at runtime for an app without having to use a database. XML EXPLANATION: This resource file has a string-array (as the name implies, an array of strings) element included in it. In the clothing.xml file that opens, add the following highlighted attribute and elements between the resource tags to create a resource file:.Right-click on the Values folder and select New > XML > Values resource file and in the New Resources dialog box that appear, give it a file name of clothing and then click the OK button.Delete the default TextView (“Hello, World!”) component.

