写入 Android 光标
Android documentation for Cursor says
This interface provides random
read-write access to the result set
returned by a database query
I could not figure out what API to modify the values using a Cursor. Is it possible to write into a Cursor?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
Android 初学者论坛上提出的类似问题的答案:
是的,有,克雷格。好问题。我很乐意提供帮助。
您可以子类化 SQLiteDatabase.CursorFactory 以从其返回
newCursor 方法,SQLiteCursor 的子类。这家工厂通过了
到 SQLiteOpenHelper 构造函数,因此,当您查询它时,它会
返回新 SQLiteCursor 子类类型的 Cursors。
然后,SQLiteCursor 子类可以公开管理它的方法
受保护的 mWindow 字段,它是一个 CursorWindow。这个对象有
putXxx 方法来操作数据。
我自己还没有尝试过,所以如果有人有任何提示或提示,
请发帖。
An answer to a similar question asked on Android Beginners forum:
Yes, there is, Craig. Good question. I'll be happy to help.
You can subclass SQLiteDatabase.CursorFactory to return, from its
newCursor method, a subclass of SQLiteCursor. This factory gets passed
to the SQLiteOpenHelper constructor so, when you query it, it will
return Cursors of your new SQLiteCursor subclass type.
The SQLiteCursor subclass can then expose methods that manage its
protected mWindow field, which is a CursorWindow. This object has
putXxx methods to manipulate the data.
I haven't tried this myself, so if anyone has any tips or hints,
please post.
无法写入游标!我想知道为什么这么说..
There is no way of writing to a cursor! I wonder why it says that..