在執行某些數據庫操作後,我將光標附加到SimpleCursorAdapter以便在ListActivity上顯示List。如果我關閉遊標在finally塊(或下面的代碼後的任意位置),不顯示在列表中設置爲SimpleCursorAdapter時,無法關閉光標
SimpleCursorAdapter scAdapter = new SimpleCursorAdapter(this,
R.layout.list_row, cursor,
new String[] { Constants.KEY_TITLE }, new int[] { R.id.text1 });
如果光標未關閉的Android拋出異常,當活動使請求到另一個活動或鈍化。
PS我試着在onPause()內部關閉遊標,但是android在onPause被調用之前抱怨。
對於那些偶然發現,在較新版本的Android上,不推薦使用'startManagingCursor'。 – 2012-07-27 03:14:01