android - newView(), bindView() scrolling with checkbox -


i want make contact picker , downloaded sample app developer.android.com - , trying add checkbox contact list.

however found when try scolling checkbox set checked randomly.

after weeks search, learned because of recycling view , found many articles solving problems getview().

however, cannot use answers , examples shown getview(), because code - developer.android.com - useing newview(), bindview().

i found answers suggesting adding new column database boolean numbers whether checked, getting data caontacts cannot modify database. so, cannot use solution.

would please me? here code - same example developer.android.com.

    public void bindview(final view view, final context context, final cursor cursor) {     final viewholder holder = (viewholder) view.gettag();     final string photouri = cursor.getstring(contactsquery.photo_thumbnail_data);      final string displayname = cursor.getstring(contactsquery.display_name);     final int startindex = indexofsearchquery(displayname);         if (startindex == -1) {             holder.text1.settext(displayname);             if (textutils.isempty(msearchterm)) {                 holder.text2.setvisibility(view.gone);             } else {                 holder.text2.setvisibility(view.visible);             }         } else {          final spannablestring highlightedname = new spannablestring(displayname);           holder.text2.setvisibility(view.gone);         }           final uri contacturi = contacts.getlookupuri(                 cursor.getlong(contactsquery.id),                 cursor.getstring(contactsquery.lookup_key));          final checkbox checkbox = (checkbox)view.findviewbyid(r.id.checkbox);         final  int position = cursor.getposition();          checkbox.setoncheckedchangelistener(null);         checkbox.setoncheckedchangelistener(new compoundbutton.oncheckedchangelistener()         {             @override             public void oncheckedchanged(compoundbutton buttonview, boolean ischecked)             {              //// should here???             }         }); 


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -