在 RealmObject 0.88 上实现可序列化 [英] Implements Serializable on RealmObject 0.88

查看:62
本文介绍了在 RealmObject 0.88 上实现可序列化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在查看 Realm 0.88 的新更新,我发现这很有趣:

I've been to see the new updates of the Realm 0.88 and I found this interesting:

  • 实现接口.

好吧,我尝试实现一个接口(可序列化)但没有成功.当我将一个对象放在意图上时,我收到此错误:

Well, I try implement an interface (Serializable) without success. when I put a object on the intent I get this error:

java.lang.RuntimeException: Parcelable encountered IOException writing serializable object (name = com.test.realmtest.network.search.response.Hotel)"

我做错了什么?

推荐答案

尽管 RealmObjects 支持接口,但它们不可分割.至少现在还没有.这里有一个问题跟踪它:https://github.com/realm/realm-java/issues/878

Even though RealmObjects support interfaces, they are not parcelable. At least not yet. There is an issue tracking it here: https://github.com/realm/realm-java/issues/878

这里描述了一种变通方法:https://realm.io/docs/java/最新/#intents

There is a work-around described here: https://realm.io/docs/java/latest/#intents

这篇关于在 RealmObject 0.88 上实现可序列化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆