Iterate through rows from Sqlite-query

后端 未结 7 1165
梦如初夏
梦如初夏 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:59

    You can use below code to go through cursor and store them in string array and after you can set them in four textview

    String array[] = new String[cursor.getCount()];
    i = 0;
    
    cursor.moveToFirst();
    while (!cursor.isAfterLast()) {
        array[i] = cursor.getString(0);
        i++;
        cursor.moveToNext();
    }
    
    0 讨论(0)
提交回复
热议问题