Thanks Mark -- Doesn't this sort of violate the MVC pattern? Moreover, does it seem odd to you that both the adapter and ListView have methods to cough up a view? Pre-selecting check boxes is sure becoming a difficult-to-do process!
I am in the debugger and experimenting with how I might get the view from the list as you suggested. I have tried list.getChildAt(0); which returned null list.getItemAtPosition(0) which returned android.content.contentresolver$cursorwrapperin...@4375e088 list.getRootView() which returned com.android.internal.policy.impl.phonewindow$decorv...@4375ac38 Can you throw me another clue? Scott On Oct 25, 4:02 pm, "Mark Murphy" <mmur...@commonsware.com> wrote: > > 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 android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---