Iterate through rows from Sqlite-query

后端 未结 7 1166
梦如初夏
梦如初夏 2020-12-02 17:57

I have a table layout that I want to populate with the result from a database query. I use a select all and the query returns four rows of data.

I use this code to

7条回答
  •  自闭症患者
    2020-12-02 18:53

    Cursor objects returned by database queries are positioned before the first entry, therefore iteration can be simplified to:

    while (cursor.moveToNext()) {
        // Extract data.
    }
    

    Reference from SQLiteDatabase.

提交回复
热议问题