This is what finally worked for me, where I’m using a cursor adapter, not just an ArrayListAdapter
for my list items:
final ListView list = getListView();
for ( int i=0; i< getListAdapter().getCount(); i++ ) {
list.setItemChecked(i, true);
}
list.getChildCount
doesn’t work because it only seems to count what’s been drawn immediately (not everything that’s off the screen) so childCount
might only be 6 or 8 items when the entire list is 100 or more items. Also as I had to use list.setItemChecked
to get the items to ‘stay checked’ — at least in my case where my list items were instances of CheckedTextView
.