Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

moveToNext() is false

//row --> 2
int row = mCursor.getCount();
for (int i = 0; i < row; i++) {
 if (mCursor.moveToPosition(i)){
  int val = mCursor.getInt(mCursor.getColumnIndexOrThrow(UTILI_COLLOC_ID_UTILI))
 }
}

I don't understand because I have 2 rows in my query. But when I want to read the seconde row with "mCursor.moveToPosition(i)", so it's false...Why ?

like image 724
douarbou Avatar asked Jul 15 '26 13:07

douarbou


1 Answers

I think you can just safely use

while(mCursor.moveToNext()) {
// code
}

instead of for looping

like image 93
Andreas Wong Avatar answered Jul 18 '26 03:07

Andreas Wong