Looping over cursor not same count as cursor count on android

view story

http://stackoverflow.com – In my app I´m using a SimpleCursorAdapter to display contacts. Each view has it´s own checkbox. in order to check all, I´m going through the cursor, putting each ID to a Set, which is progressed by the getView() method to trigger checkboxes. The problem is here: int counter = 0; if (cursor.moveToFirst()) while (cursor.moveToNext()) { contact_ids_to_skip.add(cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts._ID))); counter++; } The first list entry is always triggered, because counter is 157, and cursor.getCou (HowTos)