我有一個SimpleCursorAdapter ListActivity,因此列表視圖包含數據庫中的數據。如果我在查看列表,我希望它在SimpleCursorAdapter使用的數據庫中放入新數據時更新(重新查詢)本身。是否最好的方法是在數據庫上設置內容觀察器,並在新內容進入時調用光標上的查詢()。ListView SimpleCursorAdapter更新
2
A
回答
2
如何在數據庫上設置內容觀察者並在新內容進入時調用光標上的查詢()來實現此操作?
是的,當數據庫ContentObserver發生更改時,應該通過調用requery()
來刷新遊標。現在,這個方法不推薦使用,只是請求一個新的遊標,所以你可以異步執行,並在新遊標到達後更新你的列表視圖。
+0
好吧,很酷,看起來太容易了哈哈 – jjNford
相關問題
- 1. ListView SimpleCursorAdapter異步更新
- 2. 使用SimpleCursorAdapter更新Android ListView
- 3. Android - 更新simpleCursorAdapter
- 4. ListView - SimpleCursorAdapter - @android:id/empty
- 5. ListView with SimpleCursorAdapter和
- 6. SimpleCursorAdapter:空的ListView
- 7. 的ListView與SimpleCursorAdapter
- 8. android:使用ListAdapter和SimpleCursorAdapter刷新ListView
- 9. Android SimpleCursorAdapter/ListView問題
- 10. Android:過濾SimpleCursorAdapter ListView
- 11. SimpleCursorAdapter來填充ListView
- 12. SimpleCursorAdapter和ListView問題
- 13. ArrayIndexOutOfBoundsException與SimplecursorAdapter和ListView
- 14. 使用SimpleCursorAdapter更新基於sqlite查詢的listview
- 15. 帶有SimpleCursorAdapter的ListView在更改後不刷新
- 16. 動態更新ListView與擴展SimpleCursorAdapter和替代LiteItem樣式
- 17. Android SimpleCursorAdapter數據庫更新時更新
- 18. 更新android simplecursoradapter遊標
- 19. listview中的按鈕與simplecursoradapter
- 20. ListView和CustomAdapter擴展SimpleCursorAdapter
- 21. ListView的空當SimpleCursorAdapter關閉()
- 22. simplecursoradapter/listview到sqlite數據庫
- 23. Android - SimpleCursorAdapter ListView無法點擊
- 24. Android SimpleCursorAdapter ListView綁定問題
- 25. Android SimpleCursorAdapter - 限制ListView結果
- 26. Android ListView with SimpleCursorAdapter - 崩潰onResume
- 27. Android SimpleCursorAdapter + ListView不工作
- 28. SimpleCursorAdapter沒有填充ListView
- 29. ListView + SimpleCursorAdapter不顯示數據
- 30. Android SimpleCursorAdapter和數據庫更新
您是使用ContentProvider還是數據庫? – Selvin
他說「來自數據庫的數據」 – user999717