What is The use of moveToFirst () in SQLite Cursors

后端 未结 5 1059
花落未央
花落未央 2020-11-27 19:00

I am a programming newbie and I found this piece of code in the internet and it works fine

Cursor c=db.query(DataBase.TB_NAME, new String[] {DataBase.KEY_ROW         


        
5条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-11-27 19:30

    if (c.moveToFirst()) {
      while(!c.isAfterLast()) { // If you use c.moveToNext() here, you will bypass the first row, which is WRONG
        ...
        c.moveToNext();
      } 
    }
    

提交回复
热议问题