This is my share code. I can share with StartActivity but the app crashes in the background. The error is here and my app crashes. Thank in advence.
val bitmapUri = Uri.parse(bitmapPath)
val sendIntent = Intent(Intent.ACTION_SEND)
sendIntent.setType("image/*")
sendIntent.putExtra(Intent.EXTRA_STREAM, bitmapUri)
startActivity(Intent.createChooser(sendIntent, "share"))
java.lang.RuntimeException: android.os.TransactionTooLargeException: data parcel size 2706652 bytes
at android.app.servertransaction.PendingTransactionActions$StopInfo.run(PendingTransactionActions.java:161)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:236)
at android.app.ActivityThread.main(ActivityThread.java:7861)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:600)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967)
Caused by: android.os.TransactionTooLargeException: data parcel size 2706652 bytes
at android.os.BinderProxy.transactNative(Native Method)
at android.os.BinderProxy.transact(BinderProxy.java:540)
at android.app.IActivityTaskManager$Stub$Proxy.activityStopped(IActivityTaskManager.java:4627)
at android.app.servertransaction.PendingTransactionActions$StopInfo.run(PendingTransactionActions.java:145)
I found the problem. Actually, the error was not from the code above. The problem was that I was sending a large data with bundle. Remember, the reason for this error is that if you are using bundle, you have loaded big data on it.