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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With