gpt4 book ai didi

android - 如何将 Cursor 置于 Android 中?

转载 作者:行者123 更新时间:2023-11-29 00:18:19 27 4
gpt4 key购买 nike

我尝试将 Cursor 设置为 Intent,但出现错误:

java.lang.ClassCastException: android.content.ContentResolver$CursorWrapperInner cannot be cast to java.io.Serializable

我试试看:

Cursor myCursor = ...
intent.putExtra(QBServiceConsts.EXTRA_MY_CURSOR, (Serializable) myCursor);

我的问题是什么?谢谢!

最佳答案

游标类不可打包,更好的选择是创建 Parcelable 实体类,它将代表游标中的一行所以一行光标是实体的一个对象。使用

ArrayList<Entity> to pass using intent intent.putParcelableArrayListExtra("name", ArrayList<Entity>)

关于android - 如何将 Cursor 置于 Android 中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24837999/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com