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
开发者_如何学GoHow can i acheive that ?
Thank you for helping.
You can try this:
String res = cur.getString(cur.getColumnIndex(COL_DESCRI));
cur.close();
精彩评论