Android:greenDao模式加载器

时间:2015-09-23 08:30:29

标签: android loader greendao contentobserver

当表中的内容发生变化时,我尝试从db重新加载数据。我使用ActiveAndroid做到了,它完美无缺。

我在AsyncTaskLoader中注册了contentObserver:

public AsyncTaskObjectLoader(Context context, Uri observerUri) {
    this(context);
    context.getContentResolver().registerContentObserver(observerUri, true, new ForceLoadContentObserver());
    onContentChanged();
}

其中observerUri是来自greenDao contentProvider的表URI。它看起来像:

"content://" + AUTHORITY + "/" + TABLENAME

但它没有效果。当我将新记录插入表中时,加载程序不会重新加载数据。

0 个答案:

没有答案