【发布时间】:2011-07-04 01:07:06
【问题描述】:
我正在尝试刷新使用作为 SimpleCursorAdapter 创建的 ListAdapter 的 ListView。
这是我在 onCreate 中创建 Cursor 和 ListAdapter 的代码,用于填充 ListView。
tCursor = db.getAllEntries();
ListAdapter adapter=new SimpleCursorAdapter(this,
R.layout.row, tCursor,
new String[] columns,
new int[] {R.id.rowid, R.id.date});
setListAdapter(adapter);
然后,我用另一种方法将一些数据添加到数据库中,但我不知道如何刷新 ListView。 stackoverflow 和其他地方的类似问题提到了使用 notifyDataSetChanged() 和 requery(),但 ListAdapter 或 SimpleCursorAdapter 的方法都不是。
【问题讨论】:
标签: android listview refresh listadapter simplecursoradapter