开发者

Return a specified data at row "index" from an SQLite query

开发者 https://www.devze.com 2023-03-30 19:19 出处:网络
I have this query: Cursor cur = db.query(true, TABLE_COORD, columns_descri,null, null, null, null, null, null);

I have this query:

Cursor cur = db.query(true, TABLE_COORD, columns_descri,null, null, null, null, null, null);

And i want it to return the data of column_descri at row "index". "Index" is a paramater in my function:

 public void showOverlay (OverlayItem overlay, int index)
        {
        db = openHelper.getWritableDatabase();

        String[] columns_descri = new String[] {COL_DESCRI};

        Cursor cur = db.query(true, TABLE_COORD, columns_descri,null, null, null, null, null, null);
        if (cur.moveToPosition(index)) {
         //show an AlertDialog with description of row index
开发者_如何学Go

How can i acheive that ?

Thank you for helping.


You can try this:

String res = cur.getString(cur.getColumnIndex(COL_DESCRI));
cur.close();
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号