Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TransactionTooLargeException when sending large data through intent extras [duplicate]

In my application I'm sending data to my Activity through Intent extras.

In my specific case, I download a JSON file, convert its content to a String, and send it as Intent extra to my Activity. The size is about 500kB.

And I get a TransactionTooLargeException.

09-28 13:40:46.647: E/JavaBinder(441): !!! FAILED BINDER TRANSACTION !!!
09-28 13:40:46.647: W/ActivityManager(441): Exception in new application when starting activity com.vektor.sourfer/.SourceActivity
09-28 13:40:46.647: W/ActivityManager(441): android.os.TransactionTooLargeException
09-28 13:40:46.647: W/ActivityManager(441):     at android.os.BinderProxy.transact(Native Method)
09-28 13:40:46.647: W/ActivityManager(441):     at android.app.ApplicationThreadProxy.scheduleLaunchActivity(ApplicationThreadNative.java:723)
09-28 13:40:46.647: W/ActivityManager(441):     at com.android.server.am.ActivityStack.realStartActivityLocked(ActivityStack.java:716)
09-28 13:40:46.647: W/ActivityManager(441):     at com.android.server.am.ActivityManagerService.attachApplicationLocked(ActivityManagerService.java:4341)
09-28 13:40:46.647: W/ActivityManager(441):     at com.android.server.am.ActivityManagerService.attachApplication(ActivityManagerService.java:4405)
09-28 13:40:46.647: W/ActivityManager(441):     at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:390)
09-28 13:40:46.647: W/ActivityManager(441):     at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:1737)
09-28 13:40:46.647: W/ActivityManager(441):     at android.os.Binder.execTransact(Binder.java:388)
09-28 13:40:46.647: W/ActivityManager(441):     at dalvik.system.NativeStart.run(Native Method)
09-28 13:40:46.647: W/ActivityManager(441): Force removing ActivityRecord{421bbed8 u0 com.vektor.sourfer/.SourceActivity}: app died, no saved state

In cases like this, which is the best way to bypass this error?

like image 374
Vektor88 Avatar asked Jan 13 '23 06:01

Vektor88


1 Answers

One solution would be to save the data into a public static member variable and then access it from the second activity.

Another solution would be to save the result into a file on external storage, and then read it from that file.

like image 146
Andy Res Avatar answered Apr 28 '23 09:04

Andy Res