alandarev alandarev - 5 months ago 8
Java Question

Cursor.moveToNext without moveToFirst

Will the next code work as expected?

Cursor c = db.query(tableName, requestedColumns, condition,
conditionParams, null, null, sortOrder);
while(c.moveToNext()) {
//do stuff with rows
}


The examples I found so far suggest calling
c.moveToFirst()
prior looping, but is it really necessary?

Answer

Yes, it will work, moveToNext actually call moveToFirst

Comments