Android obtains the QQ Address Book of a contact.

Source: Internet
Author: User

First look, specific in the http://download.csdn.net/detail/xiaoxiang1123/4113040

Package COM. QQ. ui; import Java. util. list; import android. content. context; import android. view. layoutinflater; import android. view. view; import android. view. view. onclicklistener; import android. view. viewgroup; import android. widget. baseadapter; import android. widget. imageview; import android. widget. textview; public class listadapter extends baseadapter {public static final string url_prefix = "http://www.goog Le.com "; private layoutinflater; private onclicklistener; private list <person> list; Public listadapter (context, list <person> arr, onclicklistener listener) {layoutinflater = layoutinflater. from (context); this. onclicklistener = listener; List = arr;} public int getcount () {return list = NULL? 0: List. Size ();} public object getitem (INT position) {If (list! = NULL) {return list. get (position);} return NULL;} public long getitemid (INT position) {return position;} public view getview (INT position, view convertview, viewgroup parent) {viewholder holder = NULL; If (convertview = NULL) {convertview = layoutinflater. inflate (R. layout. list_item, null); holder = new viewholder (); holder. firstcharhinttextview = (textview) convertview. findviewbyid (R. id. text_first_char _ Hint); holder. ordertextview = (imageview) convertview. findviewbyid (R. id. list_order_number); holder. nametextview = (textview) convertview. findviewbyid (R. id. text_website_name); holder. urltextview = (textview) convertview. findviewbyid (R. id. text_website_url); holder. imgview = (imageview) convertview. findviewbyid (R. id. list_item_img_view); convertview. settag (holder);} else {holder = (viewholder) convertview. Gettag ();} holder. ordertextview. setimagebitmap (list. get (position ). getcontactphoto (); holder. nametextview. settext (list. get (position ). getdisplayname (); holder. urltextview. settext (list. get (position ). getphonenumber (); holder. urltextview. settextcolor (0xffffff00); holder. imgview. setonclicklistener (onclicklistener); holder. imgview. settag (position); int idx = position-1; char previewchar = idx> = 0? List. get (position ). getdisplayname (). charat (0): ''; char currentchar = List. get (position ). getdisplayname (). charat (0); If (currentchar! = Previewchar) {holder. firstcharhinttextview. setvisibility (view. visible); holder. firstcharhinttextview. settext (string. valueof (currentchar);} else {// This code segment is indispensable: After a currentview is instantiated, it will be assigned multiple times and only the position of the last value is correct holder. firstcharhinttextview. setvisibility (view. gone) ;}return convertview;} public final class viewholder {public textview firstcharhinttextview; Public imageview ordertextview; Public textview nametextview; Public textview urltextview; Public imageview imgview ;}}

Related Article

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.