What do the 3 parameters in GetView () in Android development baseadapter mean?

Source: Internet
Author: User

There is a getview () in the Baseadapter adapter that needs to be rewritten
Public View getView (int position,view converview,viewgroup parent)
{
Omitted..
}
What does the three parameter of this method mean? What is the role? I don't want to be a simple translator, but I'd better give you a concrete example.

int position position, general Baseadapter are many types of data presented in the interface, the property is judged to be displayed on the interface is the number of, by position in the Baseadapter custom array or collection of values. and displayed on the interface.
View Converview displays an item on the interface. Because the mobile phone screen is so big, so a display to the user to see the content is fixed, if you list of 1000 data, should not new1000 a converview, so memory is not enough, you should learn the control reuse, The Converview that slides out of the screen is re-used in the new item below, just to change the value he shows.

The code is as follows:
View v = null;
if (Convertview = = null) {
v = layoutinflater.from (context). Inflate (
R.layout.adapter__item, parent, false);
Holder VH = new Holder ();
Vh.text = (TextView) V.findviewbyid (R.ID.TEXT1);
V.settag (VH);
} else {
v = convertview;
}
Holder VH = (Holder) v.gettag ();
Vh.text.setText (Data[position]);
return v;

ViewGroup Parent This property is used when the XML view is loaded.
Inflate (R.layout.adapter__item, parent, false); Determine his parent control, reduce the measurement of the width and height

What do the 3 parameters in GetView () in Android development baseadapter mean?

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.