The recent use of the ListView combined with Baseadapter, the two also slowly become familiar with, here to do a small summary.
A ListView is a typical adapter control that derives from Android.widget.AdapterView, and typically consists of three parts that control views, data sources, and adapter objects. The purpose of the adapter object is to construct the list item control and bind the data item to the list item control, Baseadapter is a more common and powerful adapter, the key is the implementation of the GetView () method;
@Override Public View GetView (int position, view Convertview, ViewGroup parent) { // TODO auto-generated method Stub returnnull; }
During the adapter customization process, the developer needs to define the number of list items and determine the data content for each list item, as well as construct a list space object for the list item and bind the corresponding list item data to the list item control.
The adapter is constructed in such a way that when many things in a list item can cause the number of child controls to swell sharply, consume a lot of memory, or even crash. The Android adapter control has an input function convertview in the GetView function at design time to cache the most recent list item space object that has lost visual state . Such as
Convertview is the list item control that is used to cache the lost visual state, which is passed through the GetView function to the developer, and the developer can reuse the control object to rebind the data of the list item object, thus avoiding the overhead of constructing a new list item control. Combining Viewholder will be more efficient (avoid repeating getviewbyid ());
ListView and Baseadapter