开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜