的onSaveInstanceState限制? [英] onSaveInstanceState limit?

查看:143
本文介绍了的onSaveInstanceState限制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于去precation <一href="http://developer.android.com/reference/android/app/Activity.html#onRetainNonConfigurationInstance%28%29"><$c$c>onRetainNonConfigurationInstance我一直在利用的框架越来越多的配置更改。因为我用的是ViewPager持有我的主要片段我不能使用<一个href="http://developer.android.com/reference/android/app/Fragment.html#setRetainInstance%28boolean%29"><$c$c>setRetainInstance,这限制了我的配置更改使用的onSaveInstanceState像一个标准的活动或查看要。

Since the deprecation of onRetainNonConfigurationInstance I have been leveraging the framework more and more for Configuration changes. Since I use the ViewPager to hold my main Fragments I cannot use setRetainInstance, which limits my Configuration changes to use onSaveInstanceState like a standard Activity or View would.

据工作完全没有任何问题,但我目前通过它相当可观的序列化数据集,这让我想获得它是否是一个好主意社区输入。

It is working perfectly without any problems but I am at the moment passing a quite sizable Serializable dataset through it that makes me want to get the communities input on whether or not it is a good idea.

TL;博士:是否有的onSaveInstanceState你通过它有什么大小限制

tl;dr : Does onSaveInstanceState have a size limitation on what you pass through it?

推荐答案

这将是有益的说更多的东西比相当可观的。 :)

It would be helpful to say something more than "quite sizeable." :)

此数据通过一个IPC,而IPC限制为1MB左右。你要保持你的编组大小比显著小; 100K可能是一个很好的最大值。而真正要保持这种尽可能小(想想你把在那里,不浪费空间),因为这些数据必须由系统中,即使你自己的进程被终止RAM举行。

This data goes through an IPC, and the IPC limit is about 1MB. You want to keep your marshalled size significantly smaller than that; 100K is probably a good maximum. And really you want to keep this as small as possible (think about what you put in there and don't waste space), because this data will have to be held by the system in RAM even when your own process is killed.

这篇关于的onSaveInstanceState限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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