Android: TransactionTooLargeException – Passing large data through activities or fragments

So I encountered this problem, having to pass a large array of objects from one activity to another.

That caused a android.os.TransactionTooLargeException. So we could either break the data array into chunks or redo the UI to avoid having to pass the large array through the activity.
However, a short term solution would be to use a singleton with a synccode to ensure data was properly handed over.

Step 1: Define the singleton

Step 2: Pass the intent from Activity 1

Step 3: Get the data from Activity 2

So the idea was to pass a reference code that only Activity 2 would have. That would ensure that it is retrieving the correct object reference from the singleton. Otherwise, null will be returned which should be handled by fail-safe methods.

Leave a Reply

Your email address will not be published. Required fields are marked *