0
我正在使用以下代碼來重新加載我的ListView
。我應該如何修改它以保持ListView
的位置?保留ListView的位置
protected void refreshListView() {
datasource = new DataSource(this);
try {
datasource.ScanVirtualSystems();
} catch (Exception e) {
Log.w("Exception", "exception in ScanVirtualSystems() method");
}
MatrixCursor cursor;
cursor = datasource.getnameList();
startManagingCursor(cursor);
String[] from = { "name", "desc", "status", "path", "folder",
BaseColumns._ID };
int[] to = { R.id.name, R.id.desc, R.id.status, R.id.path };
final CustomSCAdapter adapter = new CustomSCAdapter(
Mactivity.this, R.layout.row, cursor, from, to);
adapter.notifyDataSetChanged();
setListAdapter(adapter);
}
你的第一個答案是工作的一個,這一個剛剛滾動到第一個孩子。 – 2012-04-23 07:59:13