1

For example, I have a Java Object that is a Recipe and it stores items such as recipe id, recipe name, recipe ingredients (ArrayList), recipe steps (ArrayList). Now, I have one activity and fragment A (shows recipe names in a recyclerview), which is loaded from a local asset Json file. Then, you click on a recipe name and it starts fragment B (through and interface with the activity), and it shows the Recipe information, would you pass a whole java object or would you just send something like the recipe id, then open up fragment B and reload data from the Json?

How much data is too much to pass to another activity/fragment?

Thanks folks for your input on this.

Edit: Hey guys thanks for your inputs, I did see the size limits of data being sent. I need to clarify a little bit, would you send the whole Recipe object through and intent or just pass the recipe id and the. Reload the data from the Json?

  • Please check this out: https://stackoverflow.com/questions/28729955/max-size-of-string-data-that-can-be-passed-in-intents. – Janaaaa Jul 26 '18 at 03:35

1 Answers1

0

It's more like

500KB

The amount decreases slightly per Android version.

My advice is to only add very basic arguments to an Intent, If you need to transfer more, use application instance or create a singleton container holding the data you pass around.

Raja Jawahar
  • 6,742
  • 9
  • 45
  • 56