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

當結合Content Provider時

Loader使用時和平常一樣

而Content Provider的部分則是需要

在查詢時加入

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

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

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

來達到即時更新

 

 

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

01.png

 

2. 

在查詢時加入

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

02.png

 

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

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

03.png  

arrow
arrow
    文章標籤
    CursorLoader+Content Provider
    全站熱搜

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