0

In my app i am saving a bitmap from a url in the cache using LruCache. But when i tries to share the bitmap to other apps, I am not able to send the bitmap. Can anyone tell me what is the issue?

My error log is

Caused by: android.os.TransactionTooLargeException: data parcel size 11700720 bytes
                                                                  at android.os.BinderProxy.transactNative(Native Method)
                                                                  at android.os.BinderProxy.transact(Binder.java:615)
                                                                  at android.app.ActivityManagerProxy.startActivity(ActivityManagerNative.java:3114)
                                                                  at android.app.Instrumentation.execStartActivity(Instrumentation.java:1520)
                                                                  at android.app.Activity.startActivityForResult(Activity.java:4234) 
                                                                  at android.support.v4.app.BaseFragmentActivityJB.startActivityForResult(BaseFragmentActivityJB.java:48) 
                                                                  at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:77) 
                                                                  at android.app.Activity.startActivityForResult(Activity.java:4192) 
                                                                  at android.support.v4.app.FragmentActivity.startActivityForResult(FragmentActivity.java:859) 
                                                                  at android.app.Activity.startActivity(Activity.java:4531) 
                                                                  at android.app.Activity.startActivity(Activity.java:4499) 
                                                                  at me.entri.entrime.utils.Utils.showShareIntent(Utils.java:113) 
                                                                  at me.entri.entrime.fragments.ResultsFragment$4.onClick(ResultsFragment.java:237) 
                                                                  at android.view.View.performClick(View.java:5637) 
Athul Antony
  • 220
  • 2
  • 8

1 Answers1

0

TransactionTooLargeException :

The Binder transaction buffer has a limited fixed size, currently 1Mb, which is shared by all transactions in progress for the process. Consequently this exception can be thrown when there are many transactions in progress even when most of the individual transactions are of moderate size.

You should pass URI of image to intent instead passing bitmap itself. If you don't want to use external storage then you can refer suggestions: https://stackoverflow.com/a/33182408/4644823

Community
  • 1
  • 1
Harsh Soni
  • 52
  • 7
  • I am puting the image inside the Lrucache. How can i get the uri of cached image? – Athul Antony Feb 27 '17 at 12:42
  • You do download bitmap to your external storage right? If you don't then its recommended to download it first and then add it to Lrucache. After downloading you can get URI. – Harsh Soni Feb 27 '17 at 12:47
  • what about saving images like getActivity().getFilesDir(); ? Can i access those images later? – Athul Antony Feb 27 '17 at 12:49
  • No, you can't use it to access your storage. [http://stackoverflow.com/a/21230946/4644823](http://stackoverflow.com/a/21230946/4644823) You should use **getExternalStorageDirectory ()** – Harsh Soni Feb 27 '17 at 12:54