About the getview method in adpter

Source: Internet
Author: User
 
@ Override public view getview (INT position, view convertview, viewgroup parent) {final textview V; If (convertview = NULL) {v = (textview) minflater. inflate (R. layout. action_list_item, parent, false); convertview = V;} else {v = (textview) convertview;} v. settext (mtitles [position]); Final drawable icon = micons. getdrawable (position); icon. setbounds (0, 0, icon. getintrinsicwidth (), icon. getintrinsicheight (); V. settext (mtitles [position]); V. setcompounddrawables (icon, null); Return convertview ;}

The above code snippet was encountered when I was learning a demo. action_list_item.xml only contains one textview control. The problem I am struggling with is the second half of the Code, that is, after determining whether convertview is null, the actual operation is the V Control, V. setxxx or something, while convertview does not assign a value for any operation, but why is convertview returned? The operation results for V are all reflected in convertview. Why?

Please kindly advise!

 
 

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.