Search code examples
androidfragmentandroid-architecture-componentsandroid-viewmodelandroid-architecture-navigation

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


I'm trying to pass some data between fragments using a shared ViewModel. As the docs states:

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.

What is this limitation? In my use-case, I'm passing two objects, one with four fields and the other with only two, is this reasonable?


Solution

  • Yes, it is reasonable, you basically pass a Bundle of arguments, which is limited to 500Kb - 1Mb, check this answer: Is there some limits in android' bundle?