如何将数据从 sqlite 放到 textview 中的一行。我有 2 个文本视图,我想从数据库 sqlite 获取数据。这是我的查询:
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;
}
以及如何将名称和链接的内容放入 textview。我想放在下面:
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);
谢谢。