Firebase“遇到Parcelable遇到IOException写入可序列化对象"对象包含DocumentReference的ArrayList [英] Firebase "Parcelable encountered IOException writing serializable object" with object containing ArrayList of DocumentReference

查看:45
本文介绍了Firebase“遇到Parcelable遇到IOException写入可序列化对象"对象包含DocumentReference的ArrayList的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将包含Firestore DocumentReference 的数组列表的 User 对象传递给另一个活动,当我开始活动时,出现了此异常.我没有使用Parceleable,所以您可以确认此错误是由于传递对象的复杂性所致,我必须绝对使用Parcels而不是简单的Serializeable吗?

I'm trying to pass to another activity a User object containing an Arraylist of Firestore DocumentReference and when I start the activity I got this exception. I'm not using Parceleable so can you confirm that this error is due to the complexity of the object to pass and I must absolutely use the Parcels instead of simple Serializeable?

感谢您的帮助

推荐答案

由于如果您需要序列化 DocumentReference 对象,则需要使用其

If you need to serialize a DocumentReference object you need to use its getPath() method to get a String that describes the document's location in the database. To deserialize that path String back into a DocumentReference object, use the following lines of code:

FirebaseFirestore rootRef = FirebaseFirestore.getInstance();
DocumentReference ref = rootRef.document(path);

请参阅 FirebaseFirestore.getInstance().document(path)方法.

这篇关于Firebase“遇到Parcelable遇到IOException写入可序列化对象"对象包含DocumentReference的ArrayList的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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