【发布时间】:2011-06-22 16:11:41
【问题描述】:
我有一个表格布局,我想用数据库查询的结果进行填充。我使用全选,查询返回四行数据。
我使用此代码在表格行中填充 TextView。
Cursor c = null;
c = dh.getAlternative2();
startManagingCursor(c);
// the desired columns to be bound
String[] columns = new String[] {DataHelper.KEY_ALT};
// the XML defined views which the data will be bound to
int[] to = new int[] { R.id.name_entry};
SimpleCursorAdapter mAdapter = new SimpleCursorAdapter(this,
R.layout.list_example_entry, c, columns, to);
this.setListAdapter(mAdapter);
我希望能够将 KEY_ALT 的四个不同值分开,并选择它们的去向。我希望他们填充四个不同的 TextView,而不是上面示例中的一个。
如何遍历生成的光标?
【问题讨论】:
标签: android sqlite database-cursor