Cursor基本上就具備了背景執行與觀察者模式了

當結合Content Provider時

Loader使用時和平常一樣

而Content Provider的部分則是需要

在查詢時加入

cursor.setNotificationUri(getContext().getContentResolver(), uri);

在新增, 修改, 刪除時加入

getContext().getContentResolver().notifyChange(uri, null);

來達到即時更新

 

 

1.  參考網頁http://kohoh1992.github.io/Cursor-Auto-Sync

 

2. 

在查詢時加入

cursor.setNotificationUri(getContext().getContentResolver(), uri);

 

3. 在新增, 修改, 刪除時加入

getContext().getContentResolver().notifyChange(uri, null);

 

文章標籤
全站熱搜
創作者介紹
創作者 RX1226 的頭像
RX1226

給你魚竿

RX1226 發表在 痞客邦 留言(0) 人氣(90)