Cursor cursor = db.rawQuery(...);
cursor.moveToFirst();
while (cursor.isAfterLast() == false)
{
...
cursor.moveToNext();
}
Cursor cursor = db.rawQuery(...);
for (boolean hasItem = cursor.moveToFirst();
hasItem;
hasItem = cursor.moveToNext()) {
...
}
Cursor cursor = db.rawQuery(...);
if (cursor.moveToFirst()) {
do {
...
} } while (cursor.moveToNext());
}
As you work through the code, you see a lot of code that processes each row, moves to the next row, and repeats these divi queries All of the codes above look so messy and I think I'm calling the Cursor method too much, is there a simpler way?
android cursor
while (cursor.moveToNext()) {
...
}
Since the cursor starts with the first row, it will repeat well if the first row of the cursor exists. If the cursor is empty or the last row, the repeat statement ends.
© 2024 OneMinuteCode. All rights reserved.