How to put data one row from sqlite to textview. I have 2 textview and I want to get data from database sqlite. This is my query:
public Cursor getItem(long itemId) {
SQLiteDatabase db = this.getWritableDatabase();
String selectQuery = "SELECT name, link FROM tes WHERE "
+ BaseColumns._ID + "=" + itemId;
Cursor cursor = db.rawQuery(selectQuery, null);
return cursor;
}
And how to put contents of name and link to textview. I want to put in below:
String name = ""; // how to get contents of name from coloumn name in my query?
String link = ""; // how to get contents of link from coloumn link in my query?
textName.setText(name);
textLink.setText(link);
Thanks.
Try this: