Android的 - 传递对象活动时,对象不是序列化或parcelable [英] Android - Passing object to activity when object is not serializable or parcelable

查看:133
本文介绍了Android的 - 传递对象活动时,对象不是序列化或parcelable的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想一个物体传递到另一个活动。我的目标不是parcelable或可序列化,因为它包含的是本身不parcelable或序列化对象的属性。而这些属性的属性不parcelable或序列化。而这些特性等这些属性的属性......不是parcelable或序列化。

I want to pass an object to another activity. My object is not parcelable or serializeable because it contains properties that are objects that are themselves not parcelable or serializable. And the properties of these properties are not parcelable or serializable. And the properties of these properties of these properties etc... are not parcelable or serializable.

我没有权限修改code到那些特性,这些子对象。因此,我没有权限,使他们实现序列化或parcelable。

I do not have authorization to modify the code to these child objects that are properties. Thus, I do not have permission to make them implement serializable or parcelable.

有什么其他的选择,我可以考虑的对象传递给另一个活动?

What are other options I can consider to pass an object to another activity?

推荐答案

通过你的活动,它可以用来检索单个类的对象,如密钥字符串扩展应用程序类。该活动将检索从那儿之后再次更改配置对象(如旋转)。不要忘记,以确保活动优雅地处理该情况下返回的对象是中的情况下申请被收回后,所有数据都被杀死了。

Pass your Activity a key string that it can use to retrieve the object from a singleton class such as an extended Application class. The Activity would retrieve the object from there again after configuration changes (e.g. rotation). Don't forget to ensure the Activity gracefully handles the situation where the object returned is null, in the case of the application being resumed after all data has been killed.

这篇关于Android的 - 传递对象活动时,对象不是序列化或parcelable的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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