【发布时间】:2013-03-09 15:07:43
【问题描述】:
假设您在 ContentProvider 中有一个 CONTENT_URI,您想要在其中执行一些复杂的操作并返回游标组合 (MergeCursor),而不是简单的单个 Cursor。
碰巧如果您在MergeCursor 上设置通知URI 而不是MergeCursor 中的光标,则通知将不起作用。
初始代码:
Cursor[] cursors = { extraCursorBefore, usersCursor, extraCursorAfter };
Cursor extendedCursor = new MergeCursor(cursors);
// Make sure that potential listeners are getting notified
extendedCursor.setNotificationUri(getContext().getContentResolver(), CONTENT_URI_PEOPLE);
return extendedCursor;
PS:如果有人有其他想法,或者弄清楚为什么这在原始MergeCursor 上不起作用,那么请分享您的知识。
【问题讨论】:
-
我假设你看到了这个错误报告:code.google.com/p/android/issues/detail?id=38599
标签: android android-contentprovider android-contentresolver android-cursor android-cursorloader