下面是我在DBAdapter获取id的函数,我想获取所有的ID,然后显示在toast信息的list中。不知道哪里出错了。
public Cursor fetchAllIDs() {
return mDb.query(DATABASE_TABLE0, new String[] {IDno1}, null, null, null, null, null);
}
在按钮点击事件上调用的下面的函数,我想让 toast 里填充满所有的ID.
private void fillData() {
// 从数据库中获取所有的ID
Cursor c = DBHelper.fetchAllIDs();
startManagingCursor(c);
String[] from = new String[] {DBAdapter.IDno1 };
Toast.makeText(getApplicationContext(), ""+from, Toast.LENGTH_LONG).show();
}