Simpleadapter class usage

Source: Internet
Author: User

The constructor of simpleadapter is:

Public simpleadapter (context, list <? Extends Map <string,?> Data, int resource, string [] From, int [])

The official explanation of the parameter meanings is as follows:

In the first context, we can clearly understand the meaning of context in English. It officially means that simpleadapter wants to run the associated view. What is this? Is the activity where your simpleadapter is located (generally), so this parameter is generally "the name of the previous activity. This"

The second is a generic type, as long as it is a list, this will generally be considered as an arraylist, and its internal storage is a map or an object inherited from a map, such as hashmap, these syntaxes are basic java syntaxes and are not detailed in detail! Here it is used as a data source, and each row in arralist represents the rendered row. The map key is the column name of this row, and the value also has a column name.

The third resource file, that is, the view resource file required to load the two columns, is generally created in layout. XML file. You can use a textview on the left to display the values of the left and right columns!

The fourth parameter is a string array, which maps the names in the map object to the column names.

The fifth is to display (one-to-one correspondence) the values of the fourth parameter in the next int-type ID array, this ID array is the unique int type identifier formed by the name ID in the XML file of layout.

In this way, the data list is displayed!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.