> I am using a SimpleCursorAdapter and having a similar problem with pre-
> checking certain entries.  This is my experimental code that I am
> trying immediately following the instantiation of the adapter:
>
>               adapter = new SimpleCursorAdapter(this,
>                               
> android.R.layout.simple_list_item_multiple_choice, c,
>                               new String[] { Contacts.PeopleColumns.NAME },
>                               new int[] { android.R.id.text1 });
>
>                 // TODO TEST CODE
>               CheckedTextView cb = (CheckedTextView) adapter.getView(0, null,
> null);
>               cb.setChecked(true);
>
> The list appears and the first entry is *not* checked.  Any ideas?

The View you got from your getView() call is being discarded.

Remember, *ListView* does the caching of rows. Since your requested a row
outside of ListView, ListView doesn't know about it or use it.

Add your SimpleCursorAdapter to your ListView, then call setItemChecked()
on the ListView to check your desired row, and see if that works.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com
Android App Developer Books: http://commonsware.com/books.html



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to