2013-10-11 45 views
0

我需要知道,有什麼報價函數SimpleCursorAdapter增值時?我要的是如何知道價值添加在simplecursoradapter

  1. 我打開MainActivity,有ListView集成 SimpleCursorAdapter添加數據通過後臺服務。
  2. 當通過後臺服務添加值時,我想刷新ListView並且想要 知道添加了多少新值。 (不想使用通知)。

就像AddAll()notifyDataSetChanged()ArrayAdapter

它可以嗎?

+0

像所有其他適配器一個簡單的遊標適配器確實有通知的數據集改變方法/ –

+0

如何認識和如何刷新列表動態? – ppshein

+0

yes true遊標加載器和內容提供者將爲您管理事物,cursor.setNotificationUri(getContext()。getContentResolver(),uri);通過這種方法。在遊標的情況下,我認爲你將不得不執行重新查詢。 –

回答

1

這樣做的最佳方法是在數據庫上設置內容觀察器並使用CursorLoader異步加載數據。

0

請求上增加新的記錄

一個新的光標引用:

requery() 
This method was deprecated in API level 11. Don't use this. Just request a new cursor, so you can do this asynchronously and update your list view once the new cursor comes back. 
相關問題