Apparently the cursorId is actually retrieved from the internal iterator of the Cursor. This iterator is not created until hasNext (or possibly others) is called meaning that checking if the cursor is alive by comparing its id to 0 only works after the first hasNext call.