如何实现 CrossProcessCursor 兼容的通用自定义 CursorWrapper
我设法创建了一个可用的 CursorWrapper
,但当我想跨进程使用 ContentProvider
时,我遇到了困难。
这些帖子甚至展示了如何实现 CrossProcessCursor
接口,特别是硬且未记录的 fillWindow()
方法:
问题是我可以只考虑 fillWindow()
的实现,该实现处理包含 Blob、字符串或...的所有列的游标,但不考虑这些的混合,正如现实世界的光标所必然具有的那样。这里真正的问题是缺少 getType()
函数(仅从 v11 开始存在),或 getRaw()
/putRaw()
只会复制二进制文件而不会抱怨。您如何处理这个而不在返回的游标值中引起不需要的转换?
I manage to create a working CursorWrapper
, but get stuck when I want to use my ContentProvider
across processes.
These posts even show how to implement the CrossProcessCursor
interface, notably the hard and undocumented fillWindow()
method:
The problem is that I can think only of an implementation of fillWindow()
that deals with a cursor with either all columns containing Blobs, or Strings, or ..., but not a mix of those, as a real-world cursor is bound to have. The real issue here is a lack of a getType()
function (exists only from v11 on), or a getRaw()
/putRaw()
that would just copy binary without complaining. How do you deal with this without incurring unwanted conversions in your returned cursor values?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我现在已经按如下方式实现了它,但感觉不是正确的做法或稳健的做法:
I've implemented it as follows for now, but it does not feel like the right thing to do or robust: