【发布时间】:2013-11-25 18:56:13
【问题描述】:
我有标准的ListView 活动链接到数据库:
dbHelper = new DbAdapter(this);
dbHelper.open();
recordsCursor = dbHelper.fetchAllRecords();
startManagingCursor(recordsCursor);
String[] from = new String[]{DbAdapter.KEY_1, DbAdapter.KEY_2};
int[] to = new int[]{R.id.text1, R.id.background};
adapter = new SimpleCursorAdapter(this, R.layout.row, recordsCursor, from, to);
用户可以选择通过菜单项手动更新列表。它运行任务以从服务器获取更新日期:
new SyncTask(getApplicationContext(), true).execute();
(第二个参数表示这是手动启动同步还是自动启动)
一旦同步完成(onPostExecute),如果仍然显示相同的活动,我想更新列表(fetchAllRecords、changeCursor 等)。如果是这种情况,我怎么理解?
【问题讨论】:
标签: android android-listview android-asynctask android-activity