使用导航组件时在片段之间传递数据有什么限制?

What is the limit when passing data between fragments when using Navigation Components?

我正在尝试使用共享 ViewModel 在片段之间传递一些数据。正如 docs 所述:

For example, you should pass a key to retrieve an object rather than passing the object itself, as the total space for all saved states is limited on Android.

这个限制是什么?在我的用例中,我传递了两个对象,一个有四个字段,另一个只有两个,这合理吗?

是的,这是合理的,你基本上传递了一个 Bundle of arguments,限制在 500Kb - 1Mb,检查这个答案:Is there some limits in android' bundle?