The most commonly used adapters in Android are adapter three kinds: 1.ArrayAdapter 2.SimpleAdapter 3.BaseAdpter, here we use the code in conjunction with the text to understand the way.
You first need to set up three button buttons in the start layout activity_main.xml file and set the click events separately and combine with the mainactivity
One: Arrayadapter: Easy-to-use adapter, typically used to wrap multiple values of an array or list collection into multiple list items.
1. The first step in declaring Arrayadapter: Create a Activity_array_adapter.xml, create a ListView control
2. Declaring the control in Arrayadapteractivity and building the adapter
Here is how to prepare the Data section: array data and collection data two
Here is the second parameter in adapter () when building the adapter, Textviewresouceid, which represents a Arrayadapter list item component
Two: Simpleadapter:
Create activity and declare the display interface Activity_simple_adapter
Declaring a Activity_simple_adapter_item.xml file in build adapter
Three: Baseadapter
Write to an entity class user class
Create a Userlistadapter class
Returns the Uiactivity_base_adapter_item.xml layout file in the Userlistadapter,getview method, where the method 1,getcount () and Method 4,getview () are important
Here are the five TextView written in Baseadapter written separately.
Statement baseadapteractivity
Create a layout UI interface Activity_base_adapter
This part is my own practice adapter adapter when the set of code, but only the use of the ListView, but not listed in the use of the GridView, but the difference is not particularly large
Use of adapter adapter in Android